Add Image.getSize device coverage (#56746)#56746
Open
Abbondanzo wants to merge 3 commits intofacebook:mainfrom
Open
Add Image.getSize device coverage (#56746)#56746Abbondanzo wants to merge 3 commits intofacebook:mainfrom
Abbondanzo wants to merge 3 commits intofacebook:mainfrom
Conversation
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104535939. |
Summary: This changes Android Image.getSize to return dimensions from encoded image metadata instead of the decoded CloseableImage so callers get the source image dimensions rather than dimensions affected by resize/downsampling. The EXIF-rotated JPEG case exposed a second Android-specific wrinkle: Fresco EncodedImage width/height are populated through BitmapUtil.decodeDimensionsAndColorSpace, which delegates to Android BitmapFactory bounds decoding. For the Landscape_6.jpg sample, BitmapFactory reports the encoded height as 1792 even though the JPEG SOF marker declares 1800. After applying the 90-degree EXIF rotation swap, that decoder-rounded bound becomes a returned width of 1792, while iOS returns the correct visible source dimensions of 1800x1200. Fresco is not intentionally changing the Image.getSize contract here; it is surfacing Android decoder-derived bounds that are useful for decode metadata but too imprecise for this API. To make Image.getSize match iOS and the source file, Android now reads exact JPEG SOF dimensions from the encoded stream when available, falls back to EncodedImage dimensions for other formats, and then applies the existing EXIF rotation swap. Differential Revision: D104533593
Summary: Android BitmapFactory bounds decoding can report rounded JPEG dimensions for the EXIF-rotated sample covered by RNTester. Read JPEG SOF dimensions from the encoded stream before applying EXIF rotation so Image.getSize returns the source dimensions consistently with iOS. Changelog: [Android][Fixed] Fix Image.getSize source dimensions for JPEGs whose Android bounds decoder reports rounded metadata. Differential Revision: D104600373
Summary: Pull Request resolved: facebook#56746 Add an RNTester PlatformTest case that calls Image.getSize against a small PNG, a large JPEG, and an EXIF-rotated JPEG, then verifies the dimensions reported by native image metadata. Extend the existing Image Maestro flow to open the new test and wait for the pass result, so the same flow can run against Android and iOS RNTester builds. Changelog: [Internal][Added] - Add RNTester device coverage for Image.getSize dimensions Differential Revision: D104535939
3edcde1 to
e9594d0
Compare
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.
Summary:
Add an RNTester PlatformTest case that calls Image.getSize against a small PNG, a large JPEG, and an EXIF-rotated JPEG, then verifies the dimensions reported by native image metadata. Extend the existing Image Maestro flow to open the new test and wait for the pass result, so the same flow can run against Android and iOS RNTester builds.
Changelog:
[Internal][Added] - Add RNTester device coverage for Image.getSize dimensions
Differential Revision: D104535939