How to make Picasso load images faster?

雨燕双飞 提交于 2020-01-23 03:33:26

问题


I use Picasso (image downloading library for Android). Picasso website

I charge my image like this:

Picasso.get().load("http://i.imgur.com/myImage.png").into(imageView);

But, if myImage.png is too big, the download become slow. (With bad internet connection of course)

How to make Picasso load images faster?

Can I just make the quality lower by Picasso? Or can I charge them "early" a few seconds before using them?

Note that I cannot touch the file myImage.png

---------------------

EDIT

Any idea how to charge an image "early"? Should I use invisible view and load image into it, then use the same image in my View? How to add an image to cash (By Picasso always)?


回答1:


Picasso has no control over the server fulfilling the network request or the internet connection itself. Using a service like Thumbor might help: https://github.com/thumbor/thumbor




回答2:


No, Picasso loads a smaller version of that image into the view to use less memory, However it has to download the full source image before hand.

Consider uploading smaller images to have shorter download time, You may use multiple versions of your image:

image_thumbnail.png
image_small.png
image_medium.png
image_orginal.png

Download the thumbnail first and then download the small image, Use the bigger images for bigger views.

Yes it is possible to download them "early" but it's not recommend to waste the precious battery and bandwidth on mobile phones.




回答3:


Picasso optimize the image automatically loading a smaller version of the image into the ImageView, but if the source image is "big", the load will become slow so i recommend to you optimize the source images.

Check this articles:

Image Optimization

Automating Image Optimization



来源:https://stackoverflow.com/questions/49544751/how-to-make-picasso-load-images-faster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!