1

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)?

mr L
  • 1,008
  • 13
  • 20
  • if the image is too large from the source, you will still have to download it and process it within the app. There is no magic way of speeding the download of a large file if the internet is slow. – MoGa Mar 28 '18 at 22:05

4 Answers4

1

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

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
1

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.

M. Reza Nasirloo
  • 16,434
  • 2
  • 29
  • 41
  • Any idea how to charge them "early"? Should I use invisible views or something? – mr L Mar 28 '18 at 22:25
  • @abinax Yes load them into a `Target` no need for invisible views – M. Reza Nasirloo Mar 28 '18 at 22:31
  • What is a Target please? example? – mr L Mar 28 '18 at 22:40
  • @abinax [Target is a Picasso Interface](http://square.github.io/picasso/2.x/picasso/com/squareup/picasso/Target.html), Forget it, You can use [fetch()](http://square.github.io/picasso/2.x/picasso/com/squareup/picasso/RequestCreator.html#fetch--) to preload the image [See this](https://stackoverflow.com/a/32850015/2970351) – M. Reza Nasirloo Mar 28 '18 at 23:23
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

jrod
  • 141
  • 1
  • 3
1

You could try to add this to your android manifest

<application android:hardwareAccelerated="true" ...>

i use this to load videos faster, and it works for me ;) Maybe it'll also work for you