FA-79286 / Image orientation metadata / Open access
Tap mapping ignores the axis swap for transpose tags · case 01
On tag 5 and 7 photos the fit and bounds use the stored aspect ratio.
ROOT CAUSE
Only the pure rotations swap displayed width and height.
VERIFIED REPAIR
Swap for every tag from 5 to 8.
Unsuccessful approach: A strict > 5 test still misses tag 5.
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 in (6, 8) 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 = [[[([35, 16], [9, 2], 5, [3, 11]), None], [([29, 25], [7, 6], 5, [23, 24]), [6, 5]], [([40, 25], [5, 4], 8, [32, 13]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 31], [4, 9], 8, [16, 29]), None], [([8, 10], [4, 8], 5, [4, 8]), None]], [[([26, 22], [9, 7], 7, [0, 13]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([16, 30], [4, 2], 5, [9, 29]), [3, 1]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([40, 35], [8, 6], 5, [27, 26]), [5, 4]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([39, 28], [2, 4], 5, [14, 12]), [0, 1]], [([31, 21], [7, 5], 5, [2, 18]), None], [([11, 19], [8, 2], 8, [8, 11]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([29, 33], [4, 5], 5, [5, 29]), None]], [[([27, 39], [2, 3], 7, [8, 5]), None], [([31, 38], [2, 6], 5, [4, 16]), [0, 0]], [([27, 31], [6, 9], 5, [15, 23]), [5, 5]], [([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], [([17, 29], [5, 8], 5, [14, 8]), None]], [[([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([31, 9], [5, 9], 5, [10, 8]), [4, 1]], [([22, 21], [2, 4], 5, [18, 6]), [0, 3]], [([29, 20], [4, 2], 6, [24, 13]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]]]]
labels = ["regression: displayed axis swap", "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: displayed axis swap 0 | [1, 0] | None | Failed |
| repair trap 1 | [5, 5] | [6, 5] | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | [0, 5] | [0, 5] | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | [6, 2] | None | Failed |
SHA-256 / 42581596716b252c52cae2cafebf8f2a3bb221f3e5343f3b25e5785724b868ac
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 = [[[([35, 16], [9, 2], 5, [3, 11]), None], [([29, 25], [7, 6], 5, [23, 24]), [6, 5]], [([40, 25], [5, 4], 8, [32, 13]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 31], [4, 9], 8, [16, 29]), None], [([8, 10], [4, 8], 5, [4, 8]), None]], [[([26, 22], [9, 7], 7, [0, 13]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([16, 30], [4, 2], 5, [9, 29]), [3, 1]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([40, 35], [8, 6], 5, [27, 26]), [5, 4]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([39, 28], [2, 4], 5, [14, 12]), [0, 1]], [([31, 21], [7, 5], 5, [2, 18]), None], [([11, 19], [8, 2], 8, [8, 11]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([29, 33], [4, 5], 5, [5, 29]), None]], [[([27, 39], [2, 3], 7, [8, 5]), None], [([31, 38], [2, 6], 5, [4, 16]), [0, 0]], [([27, 31], [6, 9], 5, [15, 23]), [5, 5]], [([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], [([17, 29], [5, 8], 5, [14, 8]), None]], [[([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([31, 9], [5, 9], 5, [10, 8]), [4, 1]], [([22, 21], [2, 4], 5, [18, 6]), [0, 3]], [([29, 20], [4, 2], 6, [24, 13]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]]]]
labels = ["regression: displayed axis swap", "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: displayed axis swap 0 | [1, 0] | None | Failed |
| repair trap 1 | [5, 5] | [6, 5] | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | [0, 5] | [0, 5] | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | [6, 2] | None | Failed |
SHA-256 / f4c04279e48d781decd2d36845be68d0394f5802179e5681962584a9b2fb28e7
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 = [[[([35, 16], [9, 2], 5, [3, 11]), None], [([29, 25], [7, 6], 5, [23, 24]), [6, 5]], [([40, 25], [5, 4], 8, [32, 13]), None], [([13, 34], [5, 3], 1, [10, 31]), None], [([17, 19], [3, 9], 1, [7, 11]), [0, 5]], [([13, 26], [7, 5], 8, [9, 3]), None], [([22, 31], [4, 9], 8, [16, 29]), None], [([8, 10], [4, 8], 5, [4, 8]), None]], [[([26, 22], [9, 7], 7, [0, 13]), None], [([24, 14], [5, 8], 5, [7, 8]), [2, 2]], [([16, 30], [4, 2], 5, [9, 29]), [3, 1]], [([40, 21], [2, 9], 3, [13, 12]), None], [([26, 29], [2, 4], 6, [11, 12]), [0, 2]], [([25, 26], [2, 9], 6, [18, 0]), None], [([21, 19], [8, 6], 3, [19, 2]), [0, 5]], [([40, 35], [8, 6], 5, [27, 26]), [5, 4]]], [[([17, 21], [6, 3], 5, [7, 3]), [0, 1]], [([39, 28], [2, 4], 5, [14, 12]), [0, 1]], [([31, 21], [7, 5], 5, [2, 18]), None], [([11, 19], [8, 2], 8, [8, 11]), None], [([17, 38], [4, 3], 4, [2, 16]), [0, 2]], [([35, 17], [7, 6], 1, [31, 5]), None], [([37, 32], [8, 3], 3, [9, 25]), None], [([29, 33], [4, 5], 5, [5, 29]), None]], [[([27, 39], [2, 3], 7, [8, 5]), None], [([31, 38], [2, 6], 5, [4, 16]), [0, 0]], [([27, 31], [6, 9], 5, [15, 23]), [5, 5]], [([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], [([17, 29], [5, 8], 5, [14, 8]), None]], [[([26, 16], [5, 6], 7, [22, 12]), [1, 0]], [([31, 9], [5, 9], 5, [10, 8]), [4, 1]], [([22, 21], [2, 4], 5, [18, 6]), [0, 3]], [([29, 20], [4, 2], 6, [24, 13]), None], [([29, 29], [7, 9], 8, [12, 2]), None], [([36, 16], [8, 2], 3, [32, 16]), None], [([31, 20], [7, 7], 6, [7, 16]), [5, 6]], [([15, 21], [6, 7], 7, [6, 5]), [5, 4]]]]
labels = ["regression: displayed axis swap", "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: displayed axis swap 0 | None | None | Passed |
| repair trap 1 | [6, 5] | [6, 5] | Passed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | [0, 5] | [0, 5] | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | None | None | Passed |
SHA-256 / ed6d07ad9372c26166a73f3e75010464f1192b491a8120eaeee324e8127f8f0e
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.159131+00:00.
Case digest / 4422ddb83ca7fab2073103c06150ac665e7affe144b0bf340418eaf35a481623