Editing activity rotate: Exif only rotation for imperfect images, and Jpegtran physical rotation for perfect images - #6957
Draft
rovertrack wants to merge 3 commits into
Draft
Editing activity rotate: Exif only rotation for imperfect images, and Jpegtran physical rotation for perfect images#6957rovertrack wants to merge 3 commits into
rovertrack wants to merge 3 commits into
Conversation
Editing activity rotate: Exif only rotation for imperfect images, and Jpegtran physical rotation for perfect images
nonani
reviewed
Aug 31, 2026
| val rotated = vm.rotateImage(file, relativeRotation, applicationContext.cacheDir) | ||
| imageUri = rotated.absolutePath | ||
| } else { | ||
| // EXIF-only rotation for imperfect images. |
Contributor
There was a problem hiding this comment.
After an EXIF-only rotation the Jpegtran session isn't initialized again, so it looks like any crop that follows would target the un-rotated image. Have you tested the rotate -> crop case?
|
✅ Generated APK variants! |
rovertrack
marked this pull request as draft
August 31, 2026 16:10
Contributor
Author
|
@nicolas-raoul as @nonani suggested there is a bug with the current implementation, more importantly one thing i found out was that jpegtran doesn't take into account the Exif orientation before applying edits. so making it exif orientation aware before applying transformation is the good solution. |
Member
|
Do we have example images for these cases? |
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.
Description (required)
Fixes When rotating, ajpegtran sometimes reduces resolution #6926
What changes did you make and why?
RandomAccessFileExifWriterto updated exif tags for exif only rotation.Tests performed (required)
TransformImageTest.ktScreenshots (for UI changes only)
Demo for imperfect images- Exif only rotation
Before rotating in Commons app
After rotating 90° in Commons app
Demo for perfect images - Jpegtran physical rotation
Before rotating in Commons app
After rotating in Commons app