Repository navigation
fix(cli): respect reference image orientation in grade comparisons - #5288
miguel-heygen merged 4 commits into
Conversation
|
Thanks for this, @user-github-me. This PR now has merge conflicts with |
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
miguel-heygen
left a comment
There was a problem hiding this comment.
Reviewed at b32c4f2. This is a small, well-aimed fix, and the branch now merges cleanly with main.
loadReferenceFramenow sizes the cell from sharp'sautoOrientdimensions. The CLI pinssharp ^0.35.0, which has that field, andloadSharponly ever loads that version, so there is no older sharp for this to trip on.- The tests cover all eight EXIF orientations plus a PNG control, and go from
loadReferenceFramethroughbuildGradeCompareHtml, so they check the sheet height that users actually get. The four rotated orientations fail against the old raw-dimension code, so they pin the fix. - Video references are unaffected: the extracted frame is a PNG without orientation metadata, so the dimensions come out the same as before.
One question, not blocking: the graded cells are drawn through WebGL from the <img>, with the canvas sized from naturalWidth/naturalHeight. The description confirms the sheet came out 1168×1184 for an EXIF-6 photo. Did you also check that the graded pictures inside the cells are upright and not stretched? If they are, nothing more is needed. If not, that problem predates this change and could be a follow-up.
Verdict: APPROVE
Reasoning: The dimension fix is correct for every input kind the command accepts, it is pinned by non-vacuous tests, and CI is green on a branch that merges cleanly.
grade-comparesizes image cells from the reference's displayed dimensions, including EXIF orientation. Portrait phone photos therefore keep their aspect ratio instead of being fitted into landscape cells. The source image bytes remain unchanged, and the browser retains responsibility for displaying its orientation.The update to current
mainpreserves lazy loading of Sharp throughloadSharp("grade-compare"). The color-grading guide describes the orientation behavior.Validation: the full workspace build, CLI typecheck, 19 grade-compare tests, lint/formatting, test reachability, normal commit hooks, both comment checks, and Mintlify validation/broken-link checks pass. The tests cover all eight EXIF orientations and a PNG control. An actual built-CLI run on Chrome 152 produced a 1168×1184 comparison sheet for an EXIF-6 portrait JPEG and left the input bytes unchanged.
Additional native visual validation at this head: the actual
grade-comparecommand was run on a 640×320 JPEG with EXIF orientation 6, four asymmetric color quadrants and a centered circle, using Chrome for Testing 152.0.7977.42 on macOS/Apple M4. Both the original and activewarm-daylightcells display the expected rotated quadrant order in a 320×640 portrait aspect. In each 560×1120 image cell the circle measures 210×210 pixels, confirming it is not stretched; the active grade changes the measured colors. The sheet is 1168×1184 and the input JPEG remains byte-identical. The resulting sheet was also visually inspected. This verifies orientation and shape inside the graded cells, in addition to sheet dimensions.