Whenever I’m working on a images centered Android app, I tend to look up for an easy solution to image management. Core Android SDK doesn’t help the case, however numerous solutions exist due to third party open source libraries. I came across two of such libraries (Picasso and Universal Image Loader) while developing my Android app.
I first started with Universal Image Loader (UIL) but found out that it was not really suitable for my project. So I shifted my focus to Picasso library and fortunately it was the perfect choice for my project. I won’t say Picasso is better than UIL or vice versa. Both libraries are great although each have their own features and limitations. In general, So, here I will list some of their pros and cons here which I personally experienced while using them.
Picasso is powerful image downloading and caching library for Android. It allows for hassle-free image loading often in a single line of code. Many common pitfalls of image loading on Android are handled automatically by Picasso. Some of its features are handling ImageView recycling and download cancellation in an adapter, complex image transformations with minimal memory use, automatic memory and disk caching.
- Efficient library with very little size (just around 85 KB).
- Very easy to use, usually with just a single line of code.
- Memory optimized, rarely causes any crashes or heap errors.
- Easy image manipulation and transformations.
- Little documentation available, samples not quite user friendly either.
- Uses http headers for caching of images, so provides very less control (using OkHttp makes caching a bit better).
- Not very customizable.
Universal Image Loader:
Universal Image Loader (UIL) aims to provide a reusable instrument for asynchronous image loading, caching and displaying. It is originally based on Fedor Vlasov’s project “LazyList” although vastly refactored and improved. Some of its features are multithreaded image loading, wide tuning ImageLoader’s configuration, image caching in memory and/or on device’s file system, widget support and more.
- Highly customizable, provides lots of configuration options.
- Provides good control over the image loading and caching process.
- Detailed documentation available (although bit outdated!) with lot of good samples.
- Not very memory optimized, causes heap errors often. Precise configuration can make optimization better.
- ImageLoader class automatically manipulates images to save memory. Doesn’t provides manual transformation features.
- Bit bulky with about 150 KB of size.
Both of these libraries have been around for long and have reached good stability and maturity. In general, Picasso is good for small projects where you just need to load images and not worry about the underlying process. Universal Image Loader on the other hand is good for medium to big projects. It is highly customizable and provides lot of control. Although It wants you to know the underlying process in order to work properly. If you are beginner, I would stay stick with Picasso Library. Only move to UIL if you need more control and can handle occasional memory errors.
There are other similar libraries available too like Volley, UrlImageViewHelper and Novoda. All of these have their own way of doing things but in the end they produce similar results. If you got time, I would suggest you to take a look at them and use the one which best suites your project.