FA-79266 / Image orientation metadata / Open access
Letterbox offsets use stored instead of displayed size · case 01
Taps on rotated photos land a band away from where the user touched.
ROOT CAUSE
The centring offsets subtract the stored extents although the view shows the displayed extents.
VERIFIED REPAIR
Centre using the displayed width and height.
Unsuccessful approach: Integer-dividing the offset drops the half pixel of centring.
Case contract
A viewer letterboxes the displayed image (contain fit, centred) inside a view [vw, vh]. Map a tap [tx, ty] in view coordinates to the stored pixel [x, y] of an image of stored size [w, h] with orientation tag 1..8 (invalid -> 1); tags 5..8 swap displayed axes. Taps in the letterbox bars or on the far edge return None; the displayed pixel is floor of the exact position, then mapped back through the inverse of the orientation.
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(view, size, tag, tap):
vw, vh = view
w, h = size
tx, ty = tap
if tag not in range(1, 9):
tag = 1
dw, dh = (h, w) if tag >= 5 else (w, h)
s = min(Fraction(vw, dw), Fraction(vh, dh))
ox = (vw - w * s) / 2
oy = (vh - h * s) / 2
dx = (tx - ox) / s
dy = (ty - oy) / s
if dx < 0 or dy < 0 or dx >= dw or dy >= dh:
return None
px, py = math.floor(dx), math.floor(dy)
if tag == 1:
return [px, py]
if tag == 2:
return [w - 1 - px, py]
if tag == 3:
return [w - 1 - px, h - 1 - py]
if tag == 4:
return [px, h - 1 - py]
if tag == 5:
return [py, px]
if tag == 6:
return [py, h - 1 - px]
if tag == 7:
return [w - 1 - py, h - 1 - px]
return [w - 1 - py, px]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([13, 26], [7, 5], 8, [9, 3]), None], [([27, 18], [5, 7], 7, [4, 11]), [1, 6]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([19, 36], [5, 7], 8, [17, 11]), None]], [[([14, 32], [7, 4], 7, [8, 32]), None], [([31, 20], [5, 2], 2, [3, 3]), None], [([31, 31], [8, 9], 5, [30, 8]), [1, 8]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([25, 40], [2, 8], 8, [22, 21]), [0, 7]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 16], [6, 6], 3, [5, 8]), None], [([30, 35], [3, 5], 5, [25, 8]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]]], [[([17, 29], [5, 8], 5, [14, 8]), None], [([23, 39], [2, 4], 0, [11, 20]), [0, 2]], [([17, 11], [6, 3], 5, [11, 0]), [0, 2]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([16, 11], [3, 6], 6, [5, 3]), [0, 4]]], [[([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([11, 36], [4, 4], 6, [3, 15]), [0, 2]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([36, 16], [8, 2], 3, [32, 16]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]]]]
labels = ["regression: letterbox offset extent", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: letterbox offset extent 0 | [8, 4] | [7, 4] | Failed |
| repair trap 1 | None | None | Passed |
| combined fault 2 | None | [1, 6] | Failed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | [0, 5] | [0, 5] | Passed |
| control 7 | [4, 5] | None | Failed |
SHA-256 / 79af807ea7709b14f4f9fbf154e8b263902747cbaac052837a8a0d176b8c2cf6
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(view, size, tag, tap):
vw, vh = view
w, h = size
tx, ty = tap
if tag not in range(1, 9):
tag = 1
dw, dh = (h, w) if tag >= 5 else (w, h)
s = min(Fraction(vw, dw), Fraction(vh, dh))
ox = (vw - dw * s) // 2
oy = (vh - dh * s) // 2
dx = (tx - ox) / s
dy = (ty - oy) / s
if dx < 0 or dy < 0 or dx >= dw or dy >= dh:
return None
px, py = math.floor(dx), math.floor(dy)
if tag == 1:
return [px, py]
if tag == 2:
return [w - 1 - px, py]
if tag == 3:
return [w - 1 - px, h - 1 - py]
if tag == 4:
return [px, h - 1 - py]
if tag == 5:
return [py, px]
if tag == 6:
return [py, h - 1 - px]
if tag == 7:
return [w - 1 - py, h - 1 - px]
return [w - 1 - py, px]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([13, 26], [7, 5], 8, [9, 3]), None], [([27, 18], [5, 7], 7, [4, 11]), [1, 6]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([19, 36], [5, 7], 8, [17, 11]), None]], [[([14, 32], [7, 4], 7, [8, 32]), None], [([31, 20], [5, 2], 2, [3, 3]), None], [([31, 31], [8, 9], 5, [30, 8]), [1, 8]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([25, 40], [2, 8], 8, [22, 21]), [0, 7]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 16], [6, 6], 3, [5, 8]), None], [([30, 35], [3, 5], 5, [25, 8]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]]], [[([17, 29], [5, 8], 5, [14, 8]), None], [([23, 39], [2, 4], 0, [11, 20]), [0, 2]], [([17, 11], [6, 3], 5, [11, 0]), [0, 2]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([16, 11], [3, 6], 6, [5, 3]), [0, 4]]], [[([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([11, 36], [4, 4], 6, [3, 15]), [0, 2]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([36, 16], [8, 2], 3, [32, 16]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]]]]
labels = ["regression: letterbox offset extent", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: letterbox offset extent 0 | [7, 4] | [7, 4] | Passed |
| repair trap 1 | [6, 3] | None | Failed |
| combined fault 2 | [1, 5] | [1, 6] | Failed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | [0, 5] | [0, 5] | Passed |
| control 7 | [4, 6] | None | Failed |
SHA-256 / 547e8029c1b8279a803b9b7b2835486727bc6340d5028f8ea68022921b6af27b
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(view, size, tag, tap):
vw, vh = view
w, h = size
tx, ty = tap
if tag not in range(1, 9):
tag = 1
dw, dh = (h, w) if tag >= 5 else (w, h)
s = min(Fraction(vw, dw), Fraction(vh, dh))
ox = (vw - dw * s) / 2
oy = (vh - dh * s) / 2
dx = (tx - ox) / s
dy = (ty - oy) / s
if dx < 0 or dy < 0 or dx >= dw or dy >= dh:
return None
px, py = math.floor(dx), math.floor(dy)
if tag == 1:
return [px, py]
if tag == 2:
return [w - 1 - px, py]
if tag == 3:
return [w - 1 - px, h - 1 - py]
if tag == 4:
return [px, h - 1 - py]
if tag == 5:
return [py, px]
if tag == 6:
return [py, h - 1 - px]
if tag == 7:
return [w - 1 - py, h - 1 - px]
return [w - 1 - py, px]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[([20, 22], [9, 8], 8, [11, 3]), [7, 4]], [([13, 26], [7, 5], 8, [9, 3]), None], [([27, 18], [5, 7], 7, [4, 11]), [1, 6]], [([40, 25], [5, 4], 8, [32, 13]), None], [([35, 16], [9, 2], 5, [3, 11]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([19, 36], [5, 7], 8, [17, 11]), None]], [[([14, 32], [7, 4], 7, [8, 32]), None], [([31, 20], [5, 2], 2, [3, 3]), None], [([31, 31], [8, 9], 5, [30, 8]), [1, 8]], [([40, 21], [2, 9], 3, [13, 12]), None], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([17, 18], [6, 7], 3, [1, 6]), [5, 4]], [([25, 40], [2, 8], 8, [22, 21]), [0, 7]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([27, 16], [6, 6], 3, [5, 8]), None], [([30, 35], [3, 5], 5, [25, 8]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([29, 33], [4, 5], 5, [5, 29]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([22, 15], [4, 6], 7, [16, 2]), [3, 1]]], [[([17, 29], [5, 8], 5, [14, 8]), None], [([23, 39], [2, 4], 0, [11, 20]), [0, 2]], [([17, 11], [6, 3], 5, [11, 0]), [0, 2]], [([22, 29], [9, 2], 3, [8, 26]), None], [([35, 16], [3, 9], 2, [10, 1]), None], [([39, 33], [9, 7], 1, [6, 23]), [1, 5]], [([20, 23], [3, 9], 0, [20, 12]), None], [([16, 11], [3, 6], 6, [5, 3]), [0, 4]]], [[([18, 21], [2, 4], 6, [13, 6]), [0, 1]], [([11, 36], [4, 4], 6, [3, 15]), [0, 2]], [([38, 33], [8, 5], 6, [29, 25]), [6, 0]], [([29, 20], [4, 2], 6, [24, 13]), None], [([22, 31], [8, 9], 5, [14, 4]), None], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]], [([36, 16], [8, 2], 3, [32, 16]), None], [([24, 8], [4, 7], 8, [16, 3]), [2, 5]]]]
labels = ["regression: letterbox offset extent", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: letterbox offset extent 0 | [7, 4] | [7, 4] | Passed |
| repair trap 1 | None | None | Passed |
| combined fault 2 | [1, 6] | [1, 6] | Passed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | [0, 5] | [0, 5] | Passed |
| control 7 | None | None | Passed |
SHA-256 / bb1ba4ad012bfd914e1d8b5f4fd00911e5b940ace46fd826a854bccdc311ae65
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:43.050901+00:00.
Case digest / 5ba4067027ffddbe9e192010c80cfa45b6183336aa56a73cb969f323bd8232a7