-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Low image quality using <Image/> component on RN > = 0.57 (Fresco >= 1.10.0) #2397
Comments
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions. |
What Fresco versions are RN 0.56.0 and 0.57.1 using? This narrows down the number of commits that could have caused this. |
Hello @oprisnik, I'll check and see exactly in which version patch got the upgrade when I'll return back to my office, though I think facebook/react-native#21301 (comment) reports exactly from which version got this behaviour change. |
Hi @clytras, I found the image on screen in this repository. Fresco will downsample an image to fit the OpenGL limit, the default image's max width/height is hardcode in this line. In my opinion, Create an other widget, and use this library to display a VERY large Image is many android team's choice. |
Hi @s1rius, I write the image size precisely if you read the open issue post:
This is about a behaviour change that happened from RN >= 0.57 which changed from Fresco 1.9.0 to 1.10.0. Large images like that one were working and loading in full quality before that version. Contributors from RN repo closed the issue as they state that this is not a RN issue but a Fresco lib issue. If that behavious change is intentionally made, then we can close this issue. Yes there are workarounds but it's that this was working until a version and suddenly, and with no info on why, stopped working. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to reopen with up-to-date information. |
A potential change that could have caused this is fa71901 Can you verify if that's the offending change? |
Hello again @oprisnik and thanks for investigating this. I am not so familiar with gradle and how I can change RN to compile fresco directly from source instead of downloading the library. Steps I've taken with no success:
Then I found this answer at SO https://stackoverflow.com/a/52861379/1889685 which compiles RN with fresco from source and overrides the library:
but I get the following error:
Maybe @sunnylqm can test this if he has some time, because he is way more familiar with this process. If it helps, I can create a repo with what I have so far. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions. |
I tried to build but also got the ndk error. Do you guys have nightly builds that we can test on? |
Since I can compile v2.0.0 without any modification, I tried another way to verify. I disabled downsampling which is enabled by the commit above, and here are the results test image uri: fragment_drawee_simple.xml
|
@sunnylqm thanks for debugging this. How can I disable downsampling? I've tried the following methods with no success: 1st in
With this I get a message at Logcat that Fresco is already initialized. 2nd method I've used by initializing
|
@clytras I dont know. I disabled it in source code. |
ping @oprisnik |
Looks like this is set via the React Native main package config: https://github.com/facebook/react-native/blob/6c0f73b3223968448bb186b82f06f6819068a21d/ReactAndroid/src/main/java/com/facebook/react/shell/MainPackageConfig.java Not sure how you have to set that up with RN, never tried that. |
@oprisnik Is there any plan to fix this issue? |
I believe this issue still belongs to the RN repo. Image downsampling is something that without a doubt is for reducing memory cost, gain efficiency and having less crasses when loading large images. I think this issues should be handled by RN in a way that it allows end developers to choose if they want to have image downsampling or not in a form of an option/property. For example in my app, where I use large images for presenting some floor plans, I need the high-res when the user zooms in the floor plan. I always check the device capabilities and if it's a low-end device with less RAM or low-res, then I load smaller and lower res images. There is the
I'd really like to see your thoughts on this @oprisnik @sunnylqm. |
@clytras As you've said, it's a behavior change in fresco without explanation. (The demo I show is the example app in fresco repo) So I don't think it has anything to do with RN. |
@sunnylqm of course it is a behavior change in fresco without explanation but RN should leave the choice of enabling/disabling this fresco feature to the end devs. Also don't forget that this change of behavior does not of course happen in iOS, so we have to do something about it and since fresco configuration happens in react native, then I think this configuration should be exposed to end RN developers. BTW I managed to compile Fresco 2.0.0 (master branch) with latest RN 0.61.2 and disabled downsampling by commenting out downsampling condition check at DecodeProducer.java as you did. I created a
Fresco binaries compiled successfully and image downsampling has been disabled for the RN app built by running:
|
yeah, the solution for this would be to disable downsampling for your applications, via the RN initialization logic or when Fresco is initialized. |
Unfortunately FastImage doesn't work and the issue still persists for me on the Image component, please take a look my Expo snack for reproducing this issue. https://snack.expo.dev/@joelpateljp/low-quality-image-android-example |
Also is there a timeline for when this patch will be merged? |
I ended up using webview as it displays images as is.
It works for my usecase. |
any updates on this? |
Any update on this guys. or any simple solution Fastimage is not working for me. |
Hey, is the https://docs.expo.dev/versions/unversioned/sdk/image/#allowdownscaling |
Is there any update on this? And also has anyone managed to solve this issue or have a solution? I'm not sure if the latest fresco 3.0.0 solves this issue either. |
need someone from fresco team to review this pr #2500 |
@sunnylqm Any luck on contacting other maintainers to review this? It looks like it would / should only take a few hours to review and merge but instead we're 'waiting for godot' here. |
maybe they just muted this repo. maybe you should try to find their personal sns accounts to dm. |
The suprising thing to me is that the issue is still opened. I mean, if they didn't consider this to be a bug, they would have closed the issue stating it's expected behavior, if they would recognize that this is a bug, they would have merged the fix PR. It's kind of strange. |
@clytras I mean @oprisnik knows about this issue, he has commented on this thread and his last activity on this was on Oct 28, 2019, I don't know about the other maintainers (I believe there are about 3 or 10 of them) but surely they should have looked into even merging the PR if they have access. @sunnylqm I'm still pinging the PR but I don't think there is any email to contact any of them. |
we need to wait for a new fresco release and i'll do the necessary pr on RN side. |
@sunnylqm Looks like Fresco released v3.2.0 recently, and the version bump has been merged into React Native facebook/react-native@744024b |
updated the rn config, but do not have time to build and test. |
Summary: ## Summary Adds a new `resizeMethod` called `never`. It disables downsampling on the image request and disregards the global image pipeline default. This has been a pain point raised when rendering large images on Android in issues like [this one](facebook#21301) and [this one](facebook/fresco#2397). ## Changelog [Android][Added] - Adds a new `resizeMethod`, `never`, which disables downsampling for an image Differential Revision: D62393211
…book#46866) Summary: ## Summary Adds a new `resizeMethod` called `none`. It disables downsampling on the image request and disregards the global image pipeline default. This has been a pain point raised when rendering large images on Android in issues like [this one](facebook#21301) and [this one](facebook/fresco#2397). ## Changelog [Android][Added] - Adds a new `resizeMethod`, `none`, which disables downsampling for an image Reviewed By: yungsters Differential Revision: D62393211
Summary: Pull Request resolved: #46866 ## Summary Adds a new `resizeMethod` called `none`. It disables downsampling on the image request and disregards the global image pipeline default. This has been a pain point raised when rendering large images on Android in issues like [this one](#21301) and [this one](facebook/fresco#2397). ## Changelog [Android][Added] - Adds a new `resizeMethod`, `none`, which disables downsampling for an image Reviewed By: yungsters Differential Revision: D62393211 fbshipit-source-id: d85e3ed098ad502c8edbdfa817c841271ee9e914
For FrescoFresco v3.3.0 now supports downsample overrides on a per-image-request basis following the work from #2787. You can use For React Nativex-posting my update from facebook/react-native#45078
|
Description
RN issue: RN 0.57.x Bundled large images have low quality when viewing using <Image/> component with 1:1 AR on Android [CLOSED]
There is low quality when loading large bundled (PNG, GIF and maybe more formats, NOT JPEG) images only on Android:
At the left screenshot we see the exact same code running with RN 0.56.0 and at the right screenshot we see RN 0.57.1. The code is just a simple image
<Image source={require('./assets/ELHall1.png')} resizeMethod="resize" />
and the image size is2111 x 4645 pixels
. Both projects are fresh installed usingreact-native init RN057ImageTest
andreact-native init --version="0.56.0" RN056ImageTest
. This continues to happen from 0.56 and all versions after and latest RN 0.60.x.This is confirmed to be caused by RN Fresco lib change between 0.56 and 0.57 from 1.9.0 to 1.10.0 facebook/react-native@b6f2aad. Check comment facebook/react-native#21301 (comment).
After some search at Fresco issues, I can see some related issues that it's suggested that large images should be divided and recomposed piece by piece, which it resolves many cases (most map related large images) but it can be very inconvenient especially for dynamic loaded/created images. This was working until RN 0.56 and from 0.57 and after it does not.
Reproduction
RN: It's the initial
App.js
with an<Image/>
component added.Additional Information
At this comment facebook/react-native#21301 (comment), lambdapioneer writes that this maybe is related to scale down (sub-sampling) large images:
The text was updated successfully, but these errors were encountered: