Apply EXIF orientation when resolving local image dimensions#6514
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
c39478b to
c738704
Compare
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughAdds the EXIF Orientation-Aware Image Dimensions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Goal
EXIF-rotated images (camera and selfie portrait shots) get the wrong aspect ratio:
AttachmentStorageHelper.resolveLocalDimensionsreads rawBitmapFactorybounds and ignores EXIF orientation, so a portrait photo gets a landscape attachment box. The video branch already swaps width/height for rotation.Note that there's a difference depending on the CDN:
Closes AND-1258
Implementation
The image branch of
resolveLocalDimensionsnow reads the EXIF orientation and swaps the decoded width/height for orientations that change the aspect ratio (ROTATE_90,ROTATE_270,TRANSPOSE,TRANSVERSE), mirroring the video branch's rotation handling.UI Changes
Screen_recording_20260624_110325.webm
Screen_recording_20260624_110214.webm
Testing
AttachmentStorageHelperExifTest(Robolectric) decodes a real landscape JPEG and asserts: normal orientation keeps80x40; rotate-90, rotate-270, and transpose swap to40x80.Summary by CodeRabbit