Picasso on Android: loading, resizing, and transforming images

Picasso is Square’s image loading library for Android. One chained call fetches an image from a URL, file, or resource, decodes it off the main thread, caches it, and puts it in an ImageView. It takes care of the parts that are tedious to get right by hand: memory and disk caching, downsampling large images, and cancelling the old request when a RecyclerView recycles an ImageView.
dependencies { implementation("com.squareup.picasso:picasso:2.8")}Add <uses-permission android:name="android.permission.INTERNET" /> to your manifest to load network images.
Load an image
Section titled “Load an image”Picasso.get() .load("https://example.com/image.jpg") .into(imageView);Picasso.get() returns a lazily created singleton. load also accepts a File, a Uri, or a drawable resource ID.
The same call works inside a RecyclerView.Adapter’s onBindViewHolder. When a view is recycled and bound to a new URL, Picasso cancels the earlier request for that ImageView, so you don’t get the wrong image flashing into a row.
Placeholders and error images
Section titled “Placeholders and error images”Picasso.get() .load("https://example.com/image.jpg") .placeholder(R.drawable.placeholder) .error(R.drawable.error) .into(imageView);The placeholder shows while the request is in flight. The error drawable replaces it if the load fails.
Resize and crop
Section titled “Resize and crop”Resizing to the size you display avoids decoding a full-resolution photo into memory:
Picasso.get() .load("https://example.com/image.jpg") .resize(100, 100) .centerCrop() .into(imageView);resize takes pixels. centerCrop() and centerInside() both require a resize call first, or Picasso throws. Alternatively, use .fit() to size the image to the ImageView’s measured dimensions.
Custom transformations
Section titled “Custom transformations”Implement Transformation to do your own bitmap processing. This one converts the image to grayscale:
import android.graphics.Bitmap;import android.graphics.Canvas;import android.graphics.ColorMatrix;import android.graphics.ColorMatrixColorFilter;import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class GrayscaleTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { Bitmap result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
ColorMatrix matrix = new ColorMatrix(); matrix.setSaturation(0f); Paint paint = new Paint(); paint.setColorFilter(new ColorMatrixColorFilter(matrix));
new Canvas(result).drawBitmap(source, 0f, 0f, paint); source.recycle(); return result; }
@Override public String key() { return "grayscale"; }}Two rules from Picasso’s Transformation contract: if you return a new bitmap, recycle the source; if you return the source unchanged, don’t. And key() must be unique per transformation and its parameters, because Picasso uses it as part of the memory-cache key.
Apply it with transform:
Picasso.get() .load("https://example.com/image.jpg") .transform(new GrayscaleTransformation()) .into(imageView);The same thing in Coil
Section titled “The same thing in Coil”Coil is a Kotlin-first image loader built on coroutines. With Coil 3 (3.6.3 at the time of writing), network loading is a separate artifact:
dependencies { implementation("io.coil-kt.coil3:coil:3.6.3") implementation("io.coil-kt.coil3:coil-network-okhttp:3.6.3")}The ImageView.load extension replaces the Picasso chain:
import coil3.loadimport coil3.request.errorimport coil3.request.placeholderimport coil3.request.transformationsimport coil3.transform.CircleCropTransformation
imageView.load("https://example.com/image.jpg") { placeholder(R.drawable.placeholder) error(R.drawable.error) transformations(CircleCropTransformation())}Coil also has first-class Jetpack Compose support (AsyncImage in coil-compose), which Picasso never had. Glide is the other widely used option if you’re on Java.
Further reading
Section titled “Further reading”© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)