The problem with OOM Picasso with large images

I am uploading a bunch of images to a listview using picasso. I started getting the OOM expressions I was expecting as I just loaded them without resizing or fitting.

All images are downloaded from the Internet, and some are small, but some are exceptionally large. I can't use fit () or size easily, as I want the images to keep the aspect ratio based on the width of the image that is set to match the parent, and the height on the contents of the wrapper. I read that I have to create my own transform object, but the problem is that I don't know the width of the image view in the getView method as a list (its message is 0 as it still hasn't been executed)

First question: Does picasso resize the actual image on disk when resized or resized? Or it saves them with the loaded size and then resizes them on load. Note. I got tired of fixing e.g. .resize (300,300) but still got OOM when loading this big image. 5615x374 is the size :) That's why I'm asking if picasso changes the image on disk.

Seccond question: How to fix OOM, try to get the screen size and use it to increase the image size in custom conversions and keep the aspect ratio? Or what to do when faced with images it is big ... my phone is an htc wish with only 512 RAM 4.0 android.

+3


source to share


1 answer


The answer to all my questions is: https://code.google.com/p/android-query/wiki/API

specifically: https://code.google.com/p/android-query/wiki/ImageLoading



I found several tickets on Picasso GitHub with the same problems, but unfortunately they were never resolved. No custom transform would have helped me with Picasso as I needed to resize the image on upload.

AndroidQuery handled all of this, plus it turned out to be a much better type of performance. Also, I personally think the interface will be as good as Picasso, if not better. Also AQuerry has many other useful features that Picasso does not offer.

0


source







All Articles