Skip to content

pixel-peeper: rotate HIF sources too, and decode via TIFF - #396

Merged
oddharsh merged 1 commit into
mainfrom
photos/pixel-peeper-tiff
Aug 15, 2026
Merged

oddharsh merged 1 commit into
mainfrom
photos/pixel-peeper-tiff

Conversation

@oddharsh

Copy link
Copy Markdown
Owner

Two things in load_source, one a bug and one a speed knob.

exif_transpose sat in the else arm alone, so a JPG source was cropped from
the upright frame and a HIF from the unrotated one. Ten of the eighteen
trial sources are rotated HIFs, so most of the set was cropped out of a
sideways image. Measured on XT509509: (7728, 5152) before, (5152, 7728)
after, while XT507494 (a rotated JPG) was already upright.

The decode reads TIFF rather than PNG. Both are lossless and sips writes
the same pixels either way; PNG spends its time deflating an intermediate
that is deleted a moment later. Over four sources: 7.47s to 1.25s.

Worth knowing why the rotation is now explicit in both arms rather than
left to the format. Pillow applies the orientation hint itself when it
loads a TIFF and does NOT when it loads a PNG, so the format swap alone
would have fixed the bug by accident and hidden the reason. sips is
consistent here, contrary to first appearances: it preserves the tag and
leaves pixels stored-order for png, tiff and jpeg alike.

NOT rebuilt. The trial set is curated and a rebuild would change the ten
HIF-sourced crops, which is a content decision rather than a fix.

Two things in load_source, one a bug and one a speed knob.

exif_transpose sat in the else arm alone, so a JPG source was cropped from
the upright frame and a HIF from the unrotated one. Ten of the eighteen
trial sources are rotated HIFs, so most of the set was cropped out of a
sideways image. Measured on XT509509: (7728, 5152) before, (5152, 7728)
after, while XT507494 (a rotated JPG) was already upright.

The decode reads TIFF rather than PNG. Both are lossless and sips writes
the same pixels either way; PNG spends its time deflating an intermediate
that is deleted a moment later. Over four sources: 7.47s to 1.25s.

Worth knowing why the rotation is now explicit in both arms rather than
left to the format. Pillow applies the orientation hint itself when it
loads a TIFF and does NOT when it loads a PNG, so the format swap alone
would have fixed the bug by accident and hidden the reason. sips is
consistent here, contrary to first appearances: it preserves the tag and
leaves pixels stored-order for png, tiff and jpeg alike.

NOT rebuilt. The trial set is curated and a rebuild would change the ten
HIF-sourced crops, which is a content decision rather than a fix.
@github-actions

Copy link
Copy Markdown
Contributor

Wire-size diff vs merge base

6a4c401 → 0ebedb4

Brotli q11, the quality the edge serves. Every number here is deterministic:
an unchanged file produces no row. Advisory — this check fails on nothing.

Client assets

No change. 20 files, 73.98 KiB Brotli total.

Pages

No change. 48 files, 496.67 KiB Brotli total.

Worker bundle

No change. 284.68 KiB gzip.

Dictionary deltas (pd/)

No change. 144 deltas, 461.76 KiB total.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
aadhar-sh 01bf0cb Aug 15 2026, 03:37 AM

@oddharsh
oddharsh merged commit ee9cbca into main Aug 15, 2026
8 checks passed
@oddharsh
oddharsh deleted the photos/pixel-peeper-tiff branch August 15, 2026 03:42
oddharsh added a commit that referenced this pull request Aug 15, 2026
#396 fixed load_source so a HIF is rotated before cropping, and ten of the
eighteen trial sources are rotated HIFs, so most of the set had been cut
out of a sideways frame. This is that fix reaching the page.

  18 trials kept of 31 built: chroma 1, encoder 6, quality 8, tradeoff 3
  16 of 18 carry the same axis and source as before; the crops moved
  50 tiles, 901 KB
  worst equal-budget drift shipped: 1.84%
  28 candidates dropped, each with its reason logged

The drops are the generator working rather than a loss: most are chroma
trials where 4:2:0 costs so little that no one could see the difference,
and a trial nobody can call is not a test. Same rule that rejected the
original set's unequal-byte encoder comparison.

Manifest and tiles verified in bijection, 50 named and 50 on disk, none
missing and none orphaned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant