'setDownsampleEnable(true)' cause very long picture muzzy
Description
when I user 'setDownsampleEnable(true)' and I found long picture is very muzzy, like picture with 1080x10000 . My version is 1.3.0.
Reproduction
will you advance long picture performance with 'setDownsampleEnable(true)'?
Solution
[OPTIONAL: Do you know what needs to be done to address this issue? Ideally, provide a pull request which fixes this issue.]
Additional Information
- Fresco version: 1.3.0
- Platform version: all
Hi @DankeLuo
What ResizeOptions are you using? It would also be helpful if you could attach a screenshot showing the problem.
Thanks!
Here is the screenshot. I have not used ResizeOptions, and it is my code:
DraweeController controller = Fresco.newDraweeControllerBuilder().setControllerListener(controllerListener).setUri(uri).build();
thumbnailDraweeView.setController(controller);
Hi.@DankeLuo I think you could use ResizeOptions to solve this problem. It is because that OpenGLRenderer can't load the image, when the height or width of the image is too large. Normally, the max size that OpenGLRenderer can accept is 8192 * 8192 or 4096 * 4096(depending on OpenGL version.) When you uploaded a image that is too large, the default behavior of OpenGLRenderer is compression to 1/10 of the original size. So, It looks terrible.
Before you load image in your DraweeView, you could get that image width and height, if the height or width of the image is more than the max size that OpenGLRenderer can accept, use ResizeOptions to resize the image of the OpenGLRenderer to an acceptable resolution, such as 8192 * 8192 or lower.Whether you choose maxSize * maxSize、maxSize/2 * maxSize/2 or lower, It looks a lot better then before.
This is my code:
//get the image width and height
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
int maxSize = getGLESTextureMaxSize();
//compare size
if (maxSize <= imageHeight || maxSize <= imageWidth) {
//use ResizeOptions to resize your image
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(file))
.setResizeOptions(new ResizeOptions(maxSize, maxSize, maxSize))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(imageView.getController())
.build();
imageView.setController(controller);
Hope that may help, thx.
Hi @MidoriInu1 ,
I think it still has problem with your code, since a long picture may be longer.
I hope fresco may process such event with multi GL textures (in hardware accelerate mode) or loading a part of the picture by region decode method. Thus the long picture can be displayed clearly.
@MidoriInu1 It work for me, ths.
Hi @AlexCJW , I agree with your opinion. I also hope fresco may process such event by region decode method. The feature of Region Decoding was mentioned in fresco 1.7.1 change logs, but the feature is not working after I updated. Not only that, the ResizeOptions is not working neither. (see this issue https://github.com/facebook/fresco/issues/2000) I haven't got enough time to solve this problem. (Yes, my project will delay >_<). I have to roll back fresco in my project to 1.5.0. I think we could talk it in this issue https://github.com/facebook/fresco/issues/2000 a few days later, if you are willing to. : )