Repository navigation
Conversation
A photo taken with the camera held sideways (or a mirrored scan) imported as stored, lying on its side. Probing now reports the size the picture is seen at, and the still and smart-object decodes apply the rotation or mirroring to the pixels. A missing or invalid tag decodes as stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A movie shot with a phone held upright stores sideways frames and says so in its video track header; it imported lying on its side. Probing now reports the turned size, and decoded frames (full and reduced size) are turned to match. Only the rotation is used, snapped to a quarter turn; mirroring, scaling and offsets in the header are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Superseded by #827: the head branch was renamed to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Photos and phone videos shot with the camera turned imported exactly as stored, lying on their side. They now import the way they are meant to be seen.
Stills (Exif orientation)
crates/media/src/probe.rs: probing a still reads the orientation and swaps width and height for the quarter-turn orientations (5–8). A newload_orientedhelper decodes a still and applies the rotation or mirroring to the pixels. A missing or invalid tag decodes as stored.crates/media/src/pool.rs,crates/media/src/layered.rs: the still decode (also used by image sequences) and an image embedded in a Photoshop smart object go throughload_oriented.Movies (MP4/MOV rotation)
crates/media/src/probe.rs:video_turnreads the video track header (tkhd) throughfilmcraft-isobmffand takes its rotation, snapped to the nearest quarter turn. Only the rotation is used: mirroring, scaling and offsets in the header are ignored, and other containers have none. Probing swaps width and height (and inverts the pixel aspect) for a quarter turn.crates/media/src/pool.rs: the turn is read once when the file is opened and kept beside its decoder. Decoded frames are turned, including the reduced-resolution path, which asks the decoder for the unturned size.crates/media/src/convert.rs:turnedrotates a decoded frame by 90°, 180° or 270°.crates/media/Cargo.toml: new dependency onfilmcraft-isobmff(already in the workspace, used byexport).Testing
Run locally on macOS:
cargo fmt --all -- --check,cargo clippy -p effectcraft-media --all-targets -- -D warnings,cargo xtask layers: cleancargo test -p effectcraft-media: all pass, including two new testsexif_orientation.rs: a four-colour JPEG built in memory, tagged with each of the eight orientations plus no tag and invalid values; checks size and corner colours. No ffmpeg needed.rotated_mp4_imports_uprightinfootage.rs: the H.264 fixture with its track header matrix patched to 90°, 180° and 270°; checks the probed size, exact pixels against the unrotated decode, and the reduced-size path. Skips without ffmpeg like its neighbours..movwith a 90° rotation: imports as 1440×1920 and its first frame is upright, matching ffmpeg's.Not run locally: the full
cargo xtask cigate (whole-workspace tests, assets, wasm; the wasm32 target isn't installed here).Reviewer notes
🤖 Generated with Claude Code