Search code examples
androidperformancepicasso

Picasso, image loading and resizing


I have a lot of images in my app, i am using resize and customising the width and height for many of the lists, i am getting large sized images for all of them from server. Is it a good idea to use resize or should i get smaller images from the server, wherever is needed, and remove resize() from picasso call, will this increase app performance. My main question is, does using resize a lot in your app reduces performance as it need to resize every image in your app.


Solution

  • Picasso will only resize() the image once because it will be cached (specifically stored in the LruCache) unless the cache reached the maximum limit your cache will remove an image so that it can store new ones. Accessing the deleted image again will trigger another resize() call but for those image that are still in cache Picasso will not need to perform a resize().

    If you have a full control to your server it would be better if you can create an API that has customizable image-size-parameter. Let say you only need a thumbnail image therefore you will just provide the width-height of your image rather than downloading a large image which do not give benefits on thumbnails plus you save some bandwidth.