3

On images with a >2048px long dimension Fresco automatically applies a resizing:

Android cannot display images more than 2048 pixels long in either dimension. This is beyond the capability of the OpenGL rendering system. Fresco will resize your image if it exceeds this limit.

I understand that this is done as a workaround for the OpenGL Android limit, but is there any way to control it?

Here is an example of how Fresco is rendering a 750x2440 image with the default settings: enter image description here

And here is the same image on Picasso with the default settings: enter image description here

I already tried playing with the Fresco's resizing/downsampling without success.

Gist of the code used in the images above

P.S.: Here's the URL of the image used in my testing

Matteo Mazzarolo
  • 4,420
  • 1
  • 16
  • 17

1 Answers1

0

I'm able to achieve this using only isResizeAndRotateEnabledForNetwork() from the ImagePipelineConfig class, I didn't need to tweak downsampling.

It required adding an additional step when initializing Fresco (In Application class); by configuring an image pipeline.

This is what MyApplication class looks like:

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        ImagePipelineConfig pipelineConfig = ImagePipelineConfig.newBuilder(this)
                .setResizeAndRotateEnabledForNetwork(false)
                .build();
        Fresco.initialize(this, pipelineConfig);
    }
}

So, instead of initializing Fresco with Fresco.initialize(this), add an ImagePipeline class, configure it to disable resizing for images from the network using .setResizeAndRotateEnabledForNetwork(false), then pass the configured pipeline class to Fresco.

When it's set to false:

resize_is_false

And then when it's set to true (most likely the default value):

resize_is_true

chornge
  • 2,021
  • 3
  • 28
  • 37