Skip to content

fix(index): apply EXIF orientation before rendering local images - #173

Open
OrdoAbChao7 wants to merge 1 commit into
StarTrail-org:mainfrom
OrdoAbChao7:fix/local-image-exif-orientation
Open

OrdoAbChao7 wants to merge 1 commit into
StarTrail-org:mainfrom
OrdoAbChao7:fix/local-image-exif-orientation

Conversation

@OrdoAbChao7

Copy link
Copy Markdown

Summary

Fixes #172. Applies EXIF display orientation before local-image alpha compositing, width limiting and JPEG tile generation. This is the photo-orientation follow-up left out of #119.

Previously, an 80x40 JPEG tagged with orientation 6 was written as an 80x40 tile without its orientation tag, rather than a correctly rotated 40x80 tile. Mirrored orientations were likewise lost. The 4000px width cap also used the wrong axes.

The production change is four added lines and one removed line in pipelines.py: use Pillow's ImageOps.exif_transpose() while the source is open, then continue through the existing rendering path. No dependencies change. Existing cached tiles retain the normal reuse behavior; use the existing --force rebuild to regenerate previously indexed photos.

Regression tests

The new tests invoke the real build() path and local source discovery, mocking only downstream chunk/embed/index subprocesses. No model, browser, API or download is needed.

  • All eight EXIF orientations plus absent orientation, using hand-derived corner colors to check rotation/mirroring as well as dimensions.
  • Manifest height, tile filename/source identity, source-file byte preservation and no residual non-identity orientation tag.
  • Both directions of axis swapping across the width cap.
  • Oriented transparent PNGs retain the white background.

Evidence against upstream c4a0f53052306e009a024a2e344ede8aa5eda407:

  • Before fix: 10 failed, 2 passed.
  • After fix: 12 passed.
  • Mutation replacing EXIF transposition with an unchanged image copy: 10 failed, 2 passed; normal implementation restored: 12 passed within the focused suite below.

Validation

On Windows / Python 3.13, with local source packages on PYTHONPATH:

python -m pytest tests/test_local_image_orientation.py tests/test_local_image_render.py tests/test_incremental_rerun.py tests/test_chunk.py tests/test_source_single_file.py -q -p no:cacheprovider
30 passed (no skips)

uvx ruff check .                    PASS
uvx ruff format --check .           PASS (106 files)
git diff --check                   PASS

Validation is scoped to rendering, chunking, local-source handling and incremental reruns; the full model/search pipeline was not executed.

@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

@OrdoAbChao7 is attempting to deploy a commit to the andylizf's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

bug(index): local image rendering ignores EXIF orientation

1 participant