Search code examples
androidpicasso

Picasso's image loading using fit() method


If I am using Picasso's fit() method in loading images from online, do I have to consider using BitmapFactory.Options.inSampleSize options to reduce the size of an image? I read from other stackoverflow's question (Here) that:

You can also make use of the BitmapFactory.Options.inSampleSize options to reduce the size of an image while it is loaded, rather than loading in the entire image and then creating a small copy, which wastes time and memory.

Do I have to do it after using fit()? Or it is already done by Picasso?

Thanks a lot.


Solution

  • Both fit() and explicit calls to resize() (or resizeDimen) will use inSampleSize automatically when it is appropriate to do so.

    Because inSampleSize should be a power of two for best performance and quality, your image needs to be at least twice as large as the target size for this to occur.