FAILURE MAP
← Case archive

FA-78976 / Image orientation metadata / Open access

Thumbnail ignores the axis swap for mirrored rotations · case 01

Tag 5 and 7 thumbnails are sized as landscape when the photo displays as portrait.

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

ROOT CAUSE

Only tags 6 and 8 swap dimensions; transpose (5) and transverse (7) also exchange axes.

VERIFIED REPAIR

Swap dimensions for tags 5, 6, 7 and 8 only.

Unsuccessful approach: A >= 5 test also swaps invalid tags such as 9 that must be treated as 1.

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 (6, 8):
        w, h = h, w
    s = min(Fraction(bw, w), Fraction(bh, 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 = [[[[15, 2, 7, 10, 2], [1, 2]], [[57, 33, 9, 10, 5], [9, 5]], [[25, 2, 6, 76, 343], [2, 25]], [[3, 1, 6, 10, 10], [1, 3]], [[5, 2, 2, 10, 2], [5, 2]], [[15, 10, 8, 361, 38], [10, 15]], [[5, 4158, 8, 2, 2], [2, 1]], [[296, 2, 5, 16, 45], [1, 45]]], [[[17, 50, 7, 72, 27], [50, 17]], [[5, 2, 9, 10, 218], [5, 2]], [[5, 2, 1, 19, 25], [5, 2]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[4728, 23, 5, 14, 18], [1, 18]]], [[[3, 7, 7, 21, 10], [7, 3]], [[25, 2, 9, 37, 281], [25, 2]], [[152, 2, 2, 2, 10], [2, 1]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[3, 7, 7, 18, 2], [5, 2]]], [[[3936, 7, 5, 10, 31], [1, 31]], [[15, 3805, 9, 304, 7], [1, 7]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 6, 18, 92], [2, 5]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[15, 47, 5, 2, 49], [2, 1]]], [[[5, 4, 7, 297, 10], [4, 5]], [[25, 1721, 9, 40, 380], [6, 380]], [[25, 2, 4, 54, 2], [25, 2]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[2114, 2, 8, 15, 246], [1, 246]], [[5, 7, 6, 10, 2], [3, 2]], [[23, 49, 7, 23, 20], [23, 11]]]]
labels = ["regression: tags that swap displayed axes", "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: tags that swap displayed axes 0[10, 1][1, 2]Failed
repair trap 1[9, 5][9, 5]Passed
combined fault 2[2, 25][2, 25]Passed
control 3[1, 3][1, 3]Passed
control 4[5, 2][5, 2]Passed
boundary 5[10, 15][10, 15]Passed
boundary 6[2, 1][2, 1]Passed
control 7[16, 1][1, 45]Failed

SHA-256 / 0aaaefa22261720dd76061c4b4b6bde8b3ef95fed81de9f76ce0f81b971a6f36

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 >= 5:
        w, h = h, w
    s = min(Fraction(bw, w), Fraction(bh, 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 = [[[[15, 2, 7, 10, 2], [1, 2]], [[57, 33, 9, 10, 5], [9, 5]], [[25, 2, 6, 76, 343], [2, 25]], [[3, 1, 6, 10, 10], [1, 3]], [[5, 2, 2, 10, 2], [5, 2]], [[15, 10, 8, 361, 38], [10, 15]], [[5, 4158, 8, 2, 2], [2, 1]], [[296, 2, 5, 16, 45], [1, 45]]], [[[17, 50, 7, 72, 27], [50, 17]], [[5, 2, 9, 10, 218], [5, 2]], [[5, 2, 1, 19, 25], [5, 2]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[4728, 23, 5, 14, 18], [1, 18]]], [[[3, 7, 7, 21, 10], [7, 3]], [[25, 2, 9, 37, 281], [25, 2]], [[152, 2, 2, 2, 10], [2, 1]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[3, 7, 7, 18, 2], [5, 2]]], [[[3936, 7, 5, 10, 31], [1, 31]], [[15, 3805, 9, 304, 7], [1, 7]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 6, 18, 92], [2, 5]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[15, 47, 5, 2, 49], [2, 1]]], [[[5, 4, 7, 297, 10], [4, 5]], [[25, 1721, 9, 40, 380], [6, 380]], [[25, 2, 4, 54, 2], [25, 2]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[2114, 2, 8, 15, 246], [1, 246]], [[5, 7, 6, 10, 2], [3, 2]], [[23, 49, 7, 23, 20], [23, 11]]]]
labels = ["regression: tags that swap displayed axes", "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: tags that swap displayed axes 0[1, 2][1, 2]Passed
repair trap 1[3, 5][9, 5]Failed
combined fault 2[2, 25][2, 25]Passed
control 3[1, 3][1, 3]Passed
control 4[5, 2][5, 2]Passed
boundary 5[10, 15][10, 15]Passed
boundary 6[2, 1][2, 1]Passed
control 7[1, 45][1, 45]Passed

SHA-256 / 39b369dd537e871bdf73800af9e9e191b709e545aa2177b3284eb984e8c4153c

3 / The verified repair

Exit 0
"""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(bw, w), Fraction(bh, 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 = [[[[15, 2, 7, 10, 2], [1, 2]], [[57, 33, 9, 10, 5], [9, 5]], [[25, 2, 6, 76, 343], [2, 25]], [[3, 1, 6, 10, 10], [1, 3]], [[5, 2, 2, 10, 2], [5, 2]], [[15, 10, 8, 361, 38], [10, 15]], [[5, 4158, 8, 2, 2], [2, 1]], [[296, 2, 5, 16, 45], [1, 45]]], [[[17, 50, 7, 72, 27], [50, 17]], [[5, 2, 9, 10, 218], [5, 2]], [[5, 2, 1, 19, 25], [5, 2]], [[25, 7, 2, 2, 145], [2, 1]], [[15, 2, 0, 2, 2], [2, 1]], [[5, 4382, 0, 2, 337], [1, 337]], [[25, 7, 6, 2, 2], [1, 2]], [[4728, 23, 5, 14, 18], [1, 18]]], [[[3, 7, 7, 21, 10], [7, 3]], [[25, 2, 9, 37, 281], [25, 2]], [[152, 2, 2, 2, 10], [2, 1]], [[12, 1369, 3, 1, 30], [1, 30]], [[15, 1, 1, 11, 291], [11, 1]], [[2, 1, 3, 2, 2], [2, 1]], [[15, 1, 3, 2, 10], [2, 1]], [[3, 7, 7, 18, 2], [5, 2]]], [[[3936, 7, 5, 10, 31], [1, 31]], [[15, 3805, 9, 304, 7], [1, 7]], [[1283, 2, 6, 10, 2], [1, 2]], [[5, 2, 6, 18, 92], [2, 5]], [[5, 2, 8, 2, 10], [2, 5]], [[25, 1230, 1, 10, 10], [1, 10]], [[3, 5, 2, 2, 22], [2, 3]], [[15, 47, 5, 2, 49], [2, 1]]], [[[5, 4, 7, 297, 10], [4, 5]], [[25, 1721, 9, 40, 380], [6, 380]], [[25, 2, 4, 54, 2], [25, 2]], [[3018, 47, 4, 2, 10], [2, 1]], [[15, 1, 2, 14, 14], [14, 1]], [[2114, 2, 8, 15, 246], [1, 246]], [[5, 7, 6, 10, 2], [3, 2]], [[23, 49, 7, 23, 20], [23, 11]]]]
labels = ["regression: tags that swap displayed axes", "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: tags that swap displayed axes 0[1, 2][1, 2]Passed
repair trap 1[9, 5][9, 5]Passed
combined fault 2[2, 25][2, 25]Passed
control 3[1, 3][1, 3]Passed
control 4[5, 2][5, 2]Passed
boundary 5[10, 15][10, 15]Passed
boundary 6[2, 1][2, 1]Passed
control 7[1, 45][1, 45]Passed

SHA-256 / ab8c399e6ffd6fa65b5ebf385c148d855d03e49e1212e924781a67d1f67ca6ed

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.486107+00:00.

Case digest / f51d91e9e4747574c25e953ff5774e45e070261c465af815376af7887b039e1d