An application that doesn't load images, is pretty weird and boring nowadays. Knowing how to display an image in your mobile application is one of the most common tasks for every developer. However, the way you work with them will be different for everyone, due to the way you code your app to handle the image. For example, website developers doesn't need to take care about image caching because the browser does this automatically, but for an android developer, an image will be normally loaded again and again (if we are talking from a remote/web source) without really good performance. If you are willing to display efficiently images on your application, you need to take care about the image caching.
In this top, we'll share with you 10 of the most imponent image caching libraries to increase the performance and loading times of your Android Application.
Mirage is an image loading library developed by the Android team at The Climate Corporation for loading, caching, and sync'ing for offline usage of images. Our main consideration for creating this system was to allow for explicit sync'ing of images for offline use. Libraries like Picasso didn't fulfill our requirements because as stated "Picasso doesn't have a disk cache. It delegates to whatever HTTP client".
An image download-and-cacher that also knows how to efficiently generate and retrieve thumbnails of various sizes. This library features:
- easily integrates into content-provider backed applications, providing an adapter that can read local and web URLs from a cursor
- automatic generation and caching of multiple sizes of images based on one downloaded asset
- provides a disk cache as well as a memory cache
- automatic disk cache management; no setup necessary, but parameters can be fine-tuned if desired
- designed to work with your existing setup: no extending a custom application or activity needed
- cursor adapter supports multiple image fields for each ImageView; skips fields that are null or empty
- cursor adapter has an automatic progress bar when loading the cursor
Shutterbug is an Android library that lets you fetch remote images and cache them. It is particularly suited for displaying remote images in lists or grids as it includes a convenience subclass of
FetchableImageView) that make implementation a one-liner.
A dual memory and disk cache was implemented. It makes use of two backports of Android classes: LruCache for the memory part and DiskLruCache for the disk part.
LruCache was introduced by API Level 12, but we provide it here as a standalone class so you can use the library under lower level APIs. Both
DiskLruCache are licensed under the Apache Software License, 2.0.
Shutterbug was inspired by SDWebImage which does the same thing on iOS. It uses the same structure and interface. People who are familiar with
SDWebImage on iOS will feel at home with
Shutterbug on Android.
Sligh is an easy, sample and flexible library for loading, caching and displaying images on Android written in Kotlin.
ION is an Android Asynchronous Networking and Image Loading library. This library features:
- Asynchronously download:
- Easy to use Fluent API designed for Android
- HTTP POST/PUT:
- Transparent usage of HTTP features and optimizations:
- SPDY and HTTP/2
- Gzip/Deflate Compression
- Connection pooling/reuse via HTTP Connection: keep-alive
- Uses the best/stablest connection from a server if it has multiple IP addresses
- View received headers
- Grouping and cancellation of requests
- Download progress callbacks
- Supports file:/, http(s):/, and content:/ URIs
- Request level logging and profiling
- Support for proxy servers like Charles Proxy to do request analysis
- Based on NIO and AndroidAsync
- Ability to use self signed SSL certificates
SmartImageView is a drop-in replacement for Android’s standard ImageView which additionally allows images to be loaded from URLs or the user’s contact address book. Images are cached to memory and to disk for super fast loading. This library features:
- Drop-in replacement for ImageView
- Load images from a URL
- Load images from the phone’s contact address book
- Asynchronous loading of images, loading happens outside the UI thread
- Images are cached to memory and to disk for super fast loading
- SmartImage class is easily extendable to load from other sources
UIL is a powerful and flexible library for loading, caching and displaying images on Android. UIL aims to provide a powerful, flexible and highly customizable instrument for image loading, caching and displaying. It provides a lot of configuration options and good control over the image loading and caching process. This library features:
- Multithread image loading (async or sync)
- Wide customization of ImageLoader's configuration (thread executors, downloader, decoder, memory and disk cache, display image options, etc.)
- Many customization options for every display image call (stub images, caching switch, decoding options, Bitmap processing and displaying, etc.)
- Image caching in memory and/or on disk (device's file system or SD card)
- Listening loading process (including downloading progress)
- Android 2.0+ support.
An Android library for managing images and the memory they use. Fresco takes care of image loading and display, so you don't have to. It will load images from the network, local storage, or local resources, and display a placeholder until the image has arrived. It has two levels of cache; one in memory and another in internal storage. In Android 4.x and lower, Fresco puts images in a special region of Android memory. This lets your application run faster - and suffer the dreaded
OutOfMemoryError much less often. Fresco also supports:
- streaming of progressive JPEGs
- display of animated GIFs and WebPs
- extensive customization of image loading and display
- and much more!
You can find out more at their website here.
Picasso is a powerful image downloading and caching library for Android. Images add much-needed context and visual flair to Android applications. Picasso allows for hassle-free image loading in your application—often in one line of code! Many common pitfalls of image loading on Android are handled automatically by Picasso:
ImageViewrecycling and download cancelation in an adapter.
- Complex image transformations with minimal memory use.
- Automatic memory and disk caching.
Adapter re-use is automatically detected and the previous download canceled. If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.
Glide is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface. Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead.
Glide's primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image. Glide takes in to account two key aspects of image loading performance on Android:
- The speed at which images can be decoded.
- The amount of jank incurred while decoding images.
For users to have a great experience with an app, images must not only appear quickly, but they must also do so without causing lots of jank and stuttering from main thread I/O or excessive garbage collections.
Glide takes a number of steps to ensure image loading is both as fast and as smooth as possible on Android:
- Smart and automatic downsampling and caching minimize storage overhead and decode times.
- Aggressive re-use of resources like byte arrays and Bitmaps minimizes expensive garbage collections and heap fragmentation.
- Deep lifecycle integration ensures that only requests for active Fragments and Activities are prioritized and that Applications release resources when neccessary to avoid being killed when backgrounded.
If you know another awesome image caching library for Android, please share it with the community in the comment box.