1
votes

I'm developing a gallery screen to allow the user to select some images from device and send to another user. I'm using Fresco to load the images but, depending of the device, the images are loading very slowly and the scroll on the screen is slow too.

Initially, I was loading the image this way:

Uri uriPhoto = Uri.parse("file://" + photoGallery.imageUri);
holder.draweeView.setImageURI(uriPhoto);

Then I found the setResizeOptions():

Uri uriPhoto = Uri.parse("file://" + photoGallery.imageUri);

ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uriPhoto)
        .setResizeOptions(new ResizeOptions(60, 60))
        .build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
        .setOldController(holder.draweeView.getController())
        .setImageRequest(request)
        .build();

holder.draweeView.setController(controller);

It works, but, as the documentation says:

It will slow down your decodes and possibly the rest of your app, as it's CPU-intensive

The result isn't what I, as user, expects.

Anyone knows how to solve this problem?

Thanks!

1
what do you mean by The result isn't what I, as user, expects. ? - Blackbelt
@Blackbelt in some devices who have a good camera (per example) the images are very big. In this cases, even powerful devices, are getting slow too. Not too much, but if I do a fast scroll it isn't smooth - rsicarelli
ok, I would use setDownsampleEnabled instead of setResizeOptions. Accordingly to the doc, it is supposed to be way more efficient - Blackbelt
@Blackbelt But, I have to do this in my Application, right? - rsicarelli
it should be a method of the pipeline - Blackbelt

1 Answers

0
votes

As pointed out, setting downsampling on should improve your performance. You do indeed have to do it at application or activity startup time.

Is there any reason this does not work for you?