-
Notifications
You must be signed in to change notification settings - Fork 25k
Fix: RNImage resize causes very long images to become blurryFix: Add maxBitmapSize prop to Android Image component to prevent blu… #54760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi @harshitydv1! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
I left a comment on the original issue but the existing Could you also provide screenshots in your test plan? |
|
Thank you for the feedback! I understand the concern, but I'd like to clarify why The Key Difference
The ProblemWhen
Even with The SolutionFresco's Example use case: // A 1000x4000px image
<Image
source={{ uri: 'https://example.com/very-tall-image.jpg' }}
style={{ width: 300, height: 1200 }}
resizeMethod="resize" // HOW to resize
maxBitmapSize={4096} // MAXIMUM size before downsample
/>Without |
Description
This PR addresses issue #54749 where resizing very long images on Android causes them to become blurry. This is due to Fresco's default maximum bitmap size limitation (often 2048px).
I have added a new prop
maxBitmapSizeto the AndroidImagecomponent. This allows developers to specify a custom maximum bitmap size for resizing, overriding the default limit.Changes
maxBitmapSizetoImagePropsAndroidinLibraries/Image/ImageProps.js.maxBitmapSizefield and setter inReactImageView.kt.resizeOptionsinReactImageView.ktto use the newmaxBitmapSize.maxBitmapSizeprop inReactImageManager.kt.testMaxBitmapSizeinReactImagePropertyTest.kt.Test Plan
maxBitmapSizeprop is correctly passed fromReactImageManagertoReactImageViewusing the new unit test.maxBitmapSizeto a value larger than the image dimension (e.g., 4096) to ensure it renders clearly.Related Issue
Fixes #54749…rry images
Summary:
Changelog:
Test Plan: