FAILURE MAP
← Case archive

FA-79216 / Image orientation metadata / Open access

Missing YResolution falls back to 72 dpi · case 01

A 300 dpi scan without a YResolution prints with a stretched height.

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

ROOT CAUSE

The missing Y resolution defaults to a fixed 72 dpi instead of mirroring the X resolution.

THE FAILURE

The missing Y resolution defaults to a fixed 72 dpi instead of mirroring the X resolution.

Unsuccessful approach: Any other fixed default is still unrelated to the X resolution.

Case contract

Input {w, h, tag?, unit?, xres: [num, den], yres?: [num, den]}. ResolutionUnit 2 is inches (25.4 mm), 3 is centimetres (10 mm), a missing unit defaults to 2 and any other unit has no physical size (None). A missing yres equals xres; non-positive rational parts give None. For tags 5..8 the displayed width comes from the stored height at YResolution. Return displayed [width, height] in tenths of a millimetre, each rounded half up from the exact value.

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(d):
    w, h = d['w'], d['h']
    tag = d.get('tag', 1)
    unit = d.get('unit', 2)
    per = {2: Fraction(254, 10), 3: Fraction(10)}.get(unit)
    if per is None:
        return None
    xn, xd = d['xres']
    yn, yd = d.get('yres', [72, 1])
    if xn <= 0 or xd <= 0 or yn <= 0 or yd <= 0:
        return None
    xr = Fraction(xn, xd)
    yr = Fraction(yn, yd)
    if tag in (5, 6, 7, 8):
        w, h, xr, yr = h, w, yr, xr
    def tenths(px, r):
        return math.floor(px * per * 10 / r + Fraction(1, 2))
    return [tenths(w, xr), tenths(h, yr)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[{'w': 2250, 'h': 3721, 'tag': 6, 'xres': [300, 1]}, [3150, 1905]], [{'w': 3942, 'h': 988, 'tag': 8, 'unit': 3, 'xres': [72, 1]}, [1372, 5475]], [{'w': 665, 'h': 1333, 'xres': [1000, 3]}, [507, 1016]], [{'w': 2577, 'h': 2775, 'tag': 6, 'xres': [0, 1]}, None], [{'w': 2676, 'h': 1814, 'tag': 6, 'unit': 3, 'xres': [300, 1], 'yres': [600, 1]}, [302, 892]], [{'w': 3491, 'h': 649, 'xres': [40, 1], 'yres': [1000, 3]}, [22168, 495]], [{'w': 456, 'h': 408, 'tag': 8, 'unit': 3, 'xres': [96, 1], 'yres': [96, 1]}, [425, 475]], [{'w': 2042, 'h': 678, 'unit': 3, 'xres': [150, 2]}, [2723, 904]]], [[{'w': 3188, 'h': 3159, 'tag': 1, 'unit': 2, 'xres': [1000, 3]}, [2429, 2407]], [{'w': 2100, 'h': 3201, 'unit': 2, 'xres': [40, 1]}, [13335, 20326]], [{'w': 2460, 'h': 1913, 'tag': 8, 'xres': [150, 2]}, [6479, 8331]], [{'w': 553, 'h': 1044, 'tag': 8, 'unit': 2, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 2636, 'h': 3063, 'unit': 3, 'xres': [200, 3], 'yres': [300, 1]}, [3954, 1021]], [{'w': 1140, 'h': 2204, 'tag': 5, 'unit': 3, 'xres': [40, 1], 'yres': [96, 1]}, [2296, 2850]], [{'w': 3266, 'h': 1419, 'tag': 5, 'unit': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [426, 1089]], [{'w': 3380, 'h': 2534, 'tag': 6, 'xres': [300, 1]}, [2145, 2862]]], [[{'w': 750, 'h': 307, 'tag': 8, 'unit': 3, 'xres': [150, 2]}, [409, 1000]], [{'w': 2235, 'h': 1712, 'tag': 8, 'unit': 3, 'xres': [40, 1]}, [4280, 5588]], [{'w': 3210, 'h': 2550, 'xres': [200, 3]}, [12230, 9716]], [{'w': 2503, 'h': 3897, 'tag': 6, 'unit': 1, 'xres': [200, 3], 'yres': [72, 1]}, None], [{'w': 724, 'h': 1179, 'unit': 2, 'xres': [40, 1], 'yres': [-300, 1]}, None], [{'w': 3823, 'h': 2286, 'tag': 8, 'unit': 3, 'xres': [150, 2], 'yres': [1000, 3]}, [686, 5097]], [{'w': 3374, 'h': 1982, 'tag': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [2857, 1510]], [{'w': 1427, 'h': 2175, 'tag': 8, 'unit': 2, 'xres': [96, 1]}, [5755, 3776]]], [[{'w': 3836, 'h': 472, 'tag': 8, 'xres': [200, 3]}, [1798, 14615]], [{'w': 3053, 'h': 1173, 'unit': 3, 'xres': [96, 1]}, [3180, 1222]], [{'w': 349, 'h': 941, 'tag': 6, 'unit': 3, 'xres': [150, 2]}, [1255, 465]], [{'w': 2120, 'h': 3278, 'tag': 5, 'xres': [1000, 3], 'yres': [40, 1]}, [20815, 1615]], [{'w': 1, 'h': 3356, 'tag': 7, 'xres': [-72, 1], 'yres': [96, 1]}, None], [{'w': 3732, 'h': 1632, 'tag': 6, 'unit': 3, 'xres': [150, 2], 'yres': [72, 1]}, [2267, 4976]], [{'w': 1975, 'h': 3847, 'tag': 8, 'unit': 2, 'xres': [72, 1], 'yres': [40, 1]}, [24428, 6967]], [{'w': 2768, 'h': 3254, 'tag': 1, 'unit': 3, 'xres': [300, 1]}, [923, 1085]]], [[{'w': 3100, 'h': 22, 'tag': 6, 'unit': 3, 'xres': [96, 1]}, [23, 3229]], [{'w': 951, 'h': 3743, 'tag': 8, 'unit': 3, 'xres': [7200, 100]}, [5199, 1321]], [{'w': 3668, 'h': 2643, 'tag': 7, 'unit': 3, 'xres': [200, 3]}, [3965, 5502]], [{'w': 3914, 'h': 1446, 'tag': 3, 'unit': 2, 'xres': [7200, 100], 'yres': [1000, 3]}, [13808, 1102]], [{'w': 2880, 'h': 3333, 'tag': 1, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 3908, 'h': 2121, 'tag': 6, 'unit': 1, 'xres': [96, 1], 'yres': [40, 1]}, None], [{'w': 3285, 'h': 917, 'tag': 3, 'unit': 3, 'xres': [300, 1], 'yres': [72, 1]}, [1095, 1274]], [{'w': 1800, 'h': 1611, 'tag': 6, 'xres': [1000, 3]}, [1228, 1372]]]]
labels = ["regression: missing YResolution fallback", "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: missing YResolution fallback 0[13127, 1905][3150, 1905]Failed
repair trap 1[1372, 5475][1372, 5475]Passed
combined fault 2[507, 4703][507, 1016]Failed
control 3NoneNonePassed
control 4[302, 892][302, 892]Passed
boundary 5[22168, 495][22168, 495]Passed
boundary 6[425, 475][425, 475]Passed
control 7[2723, 942][2723, 904]Failed

SHA-256 / ebc2a740d4cb326d1e2911098053802775cf071f4a23dc51e68610635e525a1d

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(d):
    w, h = d['w'], d['h']
    tag = d.get('tag', 1)
    unit = d.get('unit', 2)
    per = {2: Fraction(254, 10), 3: Fraction(10)}.get(unit)
    if per is None:
        return None
    xn, xd = d['xres']
    yn, yd = d.get('yres', [300, 1])
    if xn <= 0 or xd <= 0 or yn <= 0 or yd <= 0:
        return None
    xr = Fraction(xn, xd)
    yr = Fraction(yn, yd)
    if tag in (5, 6, 7, 8):
        w, h, xr, yr = h, w, yr, xr
    def tenths(px, r):
        return math.floor(px * per * 10 / r + Fraction(1, 2))
    return [tenths(w, xr), tenths(h, yr)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[{'w': 2250, 'h': 3721, 'tag': 6, 'xres': [300, 1]}, [3150, 1905]], [{'w': 3942, 'h': 988, 'tag': 8, 'unit': 3, 'xres': [72, 1]}, [1372, 5475]], [{'w': 665, 'h': 1333, 'xres': [1000, 3]}, [507, 1016]], [{'w': 2577, 'h': 2775, 'tag': 6, 'xres': [0, 1]}, None], [{'w': 2676, 'h': 1814, 'tag': 6, 'unit': 3, 'xres': [300, 1], 'yres': [600, 1]}, [302, 892]], [{'w': 3491, 'h': 649, 'xres': [40, 1], 'yres': [1000, 3]}, [22168, 495]], [{'w': 456, 'h': 408, 'tag': 8, 'unit': 3, 'xres': [96, 1], 'yres': [96, 1]}, [425, 475]], [{'w': 2042, 'h': 678, 'unit': 3, 'xres': [150, 2]}, [2723, 904]]], [[{'w': 3188, 'h': 3159, 'tag': 1, 'unit': 2, 'xres': [1000, 3]}, [2429, 2407]], [{'w': 2100, 'h': 3201, 'unit': 2, 'xres': [40, 1]}, [13335, 20326]], [{'w': 2460, 'h': 1913, 'tag': 8, 'xres': [150, 2]}, [6479, 8331]], [{'w': 553, 'h': 1044, 'tag': 8, 'unit': 2, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 2636, 'h': 3063, 'unit': 3, 'xres': [200, 3], 'yres': [300, 1]}, [3954, 1021]], [{'w': 1140, 'h': 2204, 'tag': 5, 'unit': 3, 'xres': [40, 1], 'yres': [96, 1]}, [2296, 2850]], [{'w': 3266, 'h': 1419, 'tag': 5, 'unit': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [426, 1089]], [{'w': 3380, 'h': 2534, 'tag': 6, 'xres': [300, 1]}, [2145, 2862]]], [[{'w': 750, 'h': 307, 'tag': 8, 'unit': 3, 'xres': [150, 2]}, [409, 1000]], [{'w': 2235, 'h': 1712, 'tag': 8, 'unit': 3, 'xres': [40, 1]}, [4280, 5588]], [{'w': 3210, 'h': 2550, 'xres': [200, 3]}, [12230, 9716]], [{'w': 2503, 'h': 3897, 'tag': 6, 'unit': 1, 'xres': [200, 3], 'yres': [72, 1]}, None], [{'w': 724, 'h': 1179, 'unit': 2, 'xres': [40, 1], 'yres': [-300, 1]}, None], [{'w': 3823, 'h': 2286, 'tag': 8, 'unit': 3, 'xres': [150, 2], 'yres': [1000, 3]}, [686, 5097]], [{'w': 3374, 'h': 1982, 'tag': 3, 'xres': [300, 1], 'yres': [1000, 3]}, [2857, 1510]], [{'w': 1427, 'h': 2175, 'tag': 8, 'unit': 2, 'xres': [96, 1]}, [5755, 3776]]], [[{'w': 3836, 'h': 472, 'tag': 8, 'xres': [200, 3]}, [1798, 14615]], [{'w': 3053, 'h': 1173, 'unit': 3, 'xres': [96, 1]}, [3180, 1222]], [{'w': 349, 'h': 941, 'tag': 6, 'unit': 3, 'xres': [150, 2]}, [1255, 465]], [{'w': 2120, 'h': 3278, 'tag': 5, 'xres': [1000, 3], 'yres': [40, 1]}, [20815, 1615]], [{'w': 1, 'h': 3356, 'tag': 7, 'xres': [-72, 1], 'yres': [96, 1]}, None], [{'w': 3732, 'h': 1632, 'tag': 6, 'unit': 3, 'xres': [150, 2], 'yres': [72, 1]}, [2267, 4976]], [{'w': 1975, 'h': 3847, 'tag': 8, 'unit': 2, 'xres': [72, 1], 'yres': [40, 1]}, [24428, 6967]], [{'w': 2768, 'h': 3254, 'tag': 1, 'unit': 3, 'xres': [300, 1]}, [923, 1085]]], [[{'w': 3100, 'h': 22, 'tag': 6, 'unit': 3, 'xres': [96, 1]}, [23, 3229]], [{'w': 951, 'h': 3743, 'tag': 8, 'unit': 3, 'xres': [7200, 100]}, [5199, 1321]], [{'w': 3668, 'h': 2643, 'tag': 7, 'unit': 3, 'xres': [200, 3]}, [3965, 5502]], [{'w': 3914, 'h': 1446, 'tag': 3, 'unit': 2, 'xres': [7200, 100], 'yres': [1000, 3]}, [13808, 1102]], [{'w': 2880, 'h': 3333, 'tag': 1, 'xres': [200, 3], 'yres': [-300, 1]}, None], [{'w': 3908, 'h': 2121, 'tag': 6, 'unit': 1, 'xres': [96, 1], 'yres': [40, 1]}, None], [{'w': 3285, 'h': 917, 'tag': 3, 'unit': 3, 'xres': [300, 1], 'yres': [72, 1]}, [1095, 1274]], [{'w': 1800, 'h': 1611, 'tag': 6, 'xres': [1000, 3]}, [1228, 1372]]]]
labels = ["regression: missing YResolution fallback", "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: missing YResolution fallback 0[3150, 1905][3150, 1905]Passed
repair trap 1[329, 5475][1372, 5475]Failed
combined fault 2[507, 1129][507, 1016]Failed
control 3NoneNonePassed
control 4[302, 892][302, 892]Passed
boundary 5[22168, 495][22168, 495]Passed
boundary 6[425, 475][425, 475]Passed
control 7[2723, 226][2723, 904]Failed

SHA-256 / f2add48b25324e9d25df86ebbe9e0918705b9f566203f4dec16386cdd97661fa

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

Case digest / 2e1b21cc08610ec49e168dbecbf83e245a0ab1ea41731aa196abc73cacf08417