Introduction
Picasso is an image loading library by Square for Android that handles image downloading, caching, and display with a minimal fluent API. It takes care of common pitfalls like ImageView recycling in adapters, memory management, and disk caching so developers can load images in a single call.
What Picasso Does
- Downloads images from URLs, file paths, resources, and content providers
- Caches downloaded images in memory (LRU) and on disk via OkHttp
- Handles ImageView recycling in ListView and RecyclerView automatically
- Applies transformations like resize, crop, rotate, and custom transforms
- Manages request cancellation when the target view is detached or recycled
Architecture Overview
Picasso uses a dispatcher pattern where requests are queued, deduped, and dispatched to a background thread pool. The Downloader (backed by OkHttp) fetches image data, which is then decoded and transformed by BitmapHunter workers. Results flow back to the main thread for view binding. A Stats object tracks cache hits, misses, and total bytes processed for debugging.
Self-Hosting & Configuration
- Add the single Gradle dependency with no annotation processors required
- Configure a custom OkHttpClient via Picasso.Builder for custom TLS or interceptors
- Set global indicator colors for debugging cache sources (memory/disk/network)
- Use setLoggingEnabled(true) to trace every request lifecycle in Logcat
- Adjust memory cache size via Picasso.Builder.memoryCache()
Key Features
- Automatic adapter-aware request cancellation prevents loading into wrong views
- Fit() and centerCrop()/centerInside() resize images to match view dimensions
- Request batching groups sequential loads for efficient dispatch
- Error and placeholder drawables with smooth fade-in transitions
- Debugging indicators show colored triangles for cache-hit sources on images
Comparison with Similar Tools
- Glide — more features (GIF, thumbnail, generated API) but larger binary; Picasso is simpler
- Coil — Kotlin-first with coroutines; Picasso uses Java patterns and OkHttp
- Fresco — handles large images via ashmem; Picasso stays lightweight
- Kingfisher (iOS) — equivalent role in the Swift ecosystem with similar API patterns
FAQ
Q: Is Picasso still maintained? A: Square maintains it for stability. It receives updates less frequently than Glide but remains functional and stable for production use.
Q: Does Picasso support GIF? A: No, Picasso does not support animated GIF playback. Use Glide or a dedicated library for animations.
Q: Can I use Picasso with Jetpack Compose? A: Picasso targets the View system. For Compose, consider Coil or Glide's Compose integration.
Q: How does Picasso handle orientation EXIF data? A: It automatically reads EXIF orientation tags and rotates the bitmap accordingly before display.