Picasso Image DownloaderThis this guide, we will see how to use Picasso library in android. Picasso is open source and one of the widely used image downloader library in Android. It is created and maintained by Square. It is among the powerful image download and caching library for Android.

Why Use Picasso?

  1. It simplifies the process of loading images from external urls and display on your application. For example, downloading an image from server, is one of the most common task in any application. And it needs quite a larger amount of code to achieve this via android networking API’s. By using Picasso, you can achieve this with few lines of code.
  2. It is always not about downloading image from remote location. You also have to think of implementing image caching logic in order to provide a seamless user experience. Picasso provides automatic image caching.
  3. Image transformation is a costly affair. If your application need deal with such runtime image transformation, you must be watchful about OutOfMemoryException. Picasso deals with it, so you don’t have to do it yourself.

How to Use Picasso Android Library?

Download the Picasso JAR file, If you haven’t done it already. If you are using eclipse as your development IDE, then just copy the downloaded picasso-2.4.0.jar file into your application lib folder. If you are using Android Studio IDE, then you have to add below dependency in build.gradle file.

dependencies {
   compile "com.squareup.picasso:picasso:2.4.0"

Loading Image from URL ImageView

We are done with configuration, let us see how to use this library to download images from remote server and display in ImageView. I assume you have your activity layout file already with ImageView declared on it.



For Picasso download image from server, you need to add below internet permissions to your project’s manifest.

<uses-permission android:name="android.permission.INTERNET" />

Now let us download the image and display on imageView

//Initialize ImageView
ImageView imageView = (ImageView) findViewById(R.id.imageView);

//Loading image from below url into imageView


In the first line we are getting ImageView instance from the layout. And then load the image from the above remote url using Picasso library.

Placeholder And Error Fallback

In the above code snippet, we have just downloaded the image and displayed on ImageView. But that is not enough always. For any real time application, you must think of all possible cases. Now we need an placeholder and error fallback for our ImageView. Placeholder image will be shown before the image is loaded. Error fallback will be shown if, there is an error while downloading image. However both fallback and placeholder are optional.

    .load("YOUR IMAGE URL HERE")
    .placeholder(R.drawable.ic_placeholder) // optional
    .error(R.drawable.ic_error_fallback)         // optional

Image Resize and Transformation

Picasso offers much more than just downloading image. It can resize the image, transform before it is displayed in ImageView.

     .load("YOUR IMAGE URL HERE")        
     .placeholder(R.drawable.ic_placeholder)   // optional        
     .error(R.drawable.ic_error_fallback)      // optional        
     .resize(250, 200)                        // optional        
     .rotate(90)                             // optional        


Some of the other alternative contenders of Picasso are:

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.
  • brahmy

    can i add url like this .load(“some url i.e related of added imagename”+item.getImageName()) if i have some json file with image name.that json file does contains image name instead of full image path.

    • Concatenate the base url with the image name
      ex: image name is abc.jpg Use Uri builder which is Android Class to build the url

  • XoLem

    It’s a nice article but can you help to explain more details about how is it caching any is there any way to control & access picasso caching?

  • Rushabh Patel

    Does Picasso support exif for the Gallery images?

  • Inzi Nasir

    thanks for helpful articlenow i want to replace url with drawable image.

  • Haseeb Kp

    Thank you

  • Shama Agrawal

    Error:Execution failed for task ‘:app:packageAllDebugClassesForMultiDex’.

    > java.util.zip.ZipException: duplicate entry: com/squareup/picasso/Action$RequestWeakReference.class

    I am getting this error.Pls suggest how to solve this

  • Sachin Rajput

    hey i am working with picasso in my project
    i am done with loading images from urls in my grid view
    now i want that if i will click any image it should be open in enlarge way and there should some option by which we can save it on memorycard
    can you help me out with this :-)

    • Shama Agrawal

      hey hiii,did you get some error like

      Error:Execution failed for task ‘:app:packageAllDebugClassesForMultiDex’.

      > java.util.zip.ZipException: duplicate entry: com/squareup/picasso/Action$RequestWeakReference.class

  • Mainak

    I can use picasso jar file without licensed agreement.

  • Derrick

    Yes….I love this. Thanks!