FAILURE MAP
← Case archive

FA-78996 / Image orientation metadata / Open access

Thumbnail scale is taken from the long sides only · case 01

Thumbnails overflow a non-square box when the image and box aspect ratios differ.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The scale compares the longest box side to the longest image side instead of fitting each axis.

THE FAILURE

The scale compares the longest box side to the longest image side instead of fitting each axis.

Unsuccessful approach: Using the shorter box side over the longer image side underfills most boxes.

Case contract

Input [stored_w, stored_h, tag, box_w, box_h]. Compute the displayed thumbnail size: tags 5..8 swap the displayed dimensions (other values, including invalid tags, do not). Scale = min(box_w/dw, box_h/dh, 1) exactly (never upscale); each side is rounded half up and is at least 1 pixel.

Why this case matters

Camera, phone and scanner images carry an orientation hint separately from the stored pixels; galleries, thumbnailers, editors and upload pipelines must interpret it consistently or photos appear sideways, mirrored or doubly rotated.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    w, h, tag, bw, bh = x
    if tag in (5, 6, 7, 8):
        w, h = h, w
    s = min(Fraction(max(bw, bh), max(w, h)), Fraction(1))
    tw = max(1, math.floor(w * s + Fraction(1, 2)))
    th = max(1, math.floor(h * s + Fraction(1, 2)))
    return [tw, th]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[5, 1, 8, 10, 2], [1, 2]], [[5, 2, 2, 10, 2], [5, 2]], [[5, 7, 6, 10, 2], [3, 2]], [[25, 2, 6, 76, 343], [2, 25]], [[3, 1, 6, 10, 10], [1, 3]], [[15, 10, 8, 361, 38], [10, 15]], [[5, 4158, 8, 2, 2], [2, 1]], [[2916, 3374, 8, 22, 164], [22, 19]]], [[[25, 7, 2, 2, 145], [2, 1]], [[3, 7, 5, 10, 2], [5, 2]], [[3942, 3691, 8, 10, 301], [10, 11]], [[15, 2, 0, 2, 2], [2, 1]], [[25, 7, 6, 2, 2], [1, 2]], [[5, 1, 6, 136, 45], [1, 5]], [[3, 1412, 3, 2, 2], [1, 2]], [[3, 7, 4, 2, 6], [2, 5]]], [[[15, 1, 3, 2, 10], [2, 1]], [[25, 7, 7, 10, 345], [7, 25]], [[45, 58, 7, 40, 2], [3, 2]], [[1669, 12, 4, 2, 2], [2, 1]], [[25, 2, 4, 2, 2], [2, 1]], [[3, 7, 6, 38, 32], [7, 3]], [[3, 7, 7, 21, 10], [7, 3]], [[15, 1, 1, 11, 291], [11, 1]]], [[[1283, 2, 6, 10, 2], [1, 2]], [[1584, 7, 0, 266, 9], [266, 1]], [[3, 7, 7, 10, 2], [5, 2]], [[3, 7, 3, 10, 141], [3, 7]], [[25, 1959, 9, 10, 10], [1, 10]], [[25, 7, 6, 2, 2], [1, 2]], [[3, 7, 5, 77, 147], [7, 3]], [[804, 1, 2, 2, 247], [2, 1]]], [[[25, 2, 6, 10, 2], [1, 2]], [[23, 49, 7, 23, 20], [23, 11]], [[5, 7, 7, 10, 2], [3, 2]], [[25, 2, 7, 10, 10], [1, 10]], [[3, 1, 5, 10, 32], [1, 3]], [[5, 1, 8, 10, 20], [1, 5]], [[1125, 3267, 8, 10, 10], [10, 3]], [[3018, 47, 4, 2, 10], [2, 1]]]]
labels = ["regression: scale from constraining side", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: scale from constraining side 0[1, 5][1, 2]Failed
repair trap 1[5, 2][5, 2]Passed
combined fault 2[7, 5][3, 2]Failed
control 3[2, 25][2, 25]Passed
control 4[1, 3][1, 3]Passed
boundary 5[10, 15][10, 15]Passed
boundary 6[2, 1][2, 1]Passed
control 7[164, 142][22, 19]Failed

SHA-256 / 3f7fdd35bedbaffb45a0695741703359c5db828f872879059e76ba237ba775e1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    w, h, tag, bw, bh = x
    if tag in (5, 6, 7, 8):
        w, h = h, w
    s = min(Fraction(min(bw, bh), max(w, h)), Fraction(1))
    tw = max(1, math.floor(w * s + Fraction(1, 2)))
    th = max(1, math.floor(h * s + Fraction(1, 2)))
    return [tw, th]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[5, 1, 8, 10, 2], [1, 2]], [[5, 2, 2, 10, 2], [5, 2]], [[5, 7, 6, 10, 2], [3, 2]], [[25, 2, 6, 76, 343], [2, 25]], [[3, 1, 6, 10, 10], [1, 3]], [[15, 10, 8, 361, 38], [10, 15]], [[5, 4158, 8, 2, 2], [2, 1]], [[2916, 3374, 8, 22, 164], [22, 19]]], [[[25, 7, 2, 2, 145], [2, 1]], [[3, 7, 5, 10, 2], [5, 2]], [[3942, 3691, 8, 10, 301], [10, 11]], [[15, 2, 0, 2, 2], [2, 1]], [[25, 7, 6, 2, 2], [1, 2]], [[5, 1, 6, 136, 45], [1, 5]], [[3, 1412, 3, 2, 2], [1, 2]], [[3, 7, 4, 2, 6], [2, 5]]], [[[15, 1, 3, 2, 10], [2, 1]], [[25, 7, 7, 10, 345], [7, 25]], [[45, 58, 7, 40, 2], [3, 2]], [[1669, 12, 4, 2, 2], [2, 1]], [[25, 2, 4, 2, 2], [2, 1]], [[3, 7, 6, 38, 32], [7, 3]], [[3, 7, 7, 21, 10], [7, 3]], [[15, 1, 1, 11, 291], [11, 1]]], [[[1283, 2, 6, 10, 2], [1, 2]], [[1584, 7, 0, 266, 9], [266, 1]], [[3, 7, 7, 10, 2], [5, 2]], [[3, 7, 3, 10, 141], [3, 7]], [[25, 1959, 9, 10, 10], [1, 10]], [[25, 7, 6, 2, 2], [1, 2]], [[3, 7, 5, 77, 147], [7, 3]], [[804, 1, 2, 2, 247], [2, 1]]], [[[25, 2, 6, 10, 2], [1, 2]], [[23, 49, 7, 23, 20], [23, 11]], [[5, 7, 7, 10, 2], [3, 2]], [[25, 2, 7, 10, 10], [1, 10]], [[3, 1, 5, 10, 32], [1, 3]], [[5, 1, 8, 10, 20], [1, 5]], [[1125, 3267, 8, 10, 10], [10, 3]], [[3018, 47, 4, 2, 10], [2, 1]]]]
labels = ["regression: scale from constraining side", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: scale from constraining side 0[1, 2][1, 2]Passed
repair trap 1[2, 1][5, 2]Failed
combined fault 2[2, 1][3, 2]Failed
control 3[2, 25][2, 25]Passed
control 4[1, 3][1, 3]Passed
boundary 5[10, 15][10, 15]Passed
boundary 6[2, 1][2, 1]Passed
control 7[22, 19][22, 19]Passed

SHA-256 / 348f947e48f9bb583c0a2927d2c0f6695433616d5f069b7376980c48a12b4683

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:40.484610+00:00.

Case digest / ea11fa577323722b2f086b5749a44969d42e9ba501b59de57afcd7ecdba4c1a9