Why Coil is becoming more popular image loading library for android? ๐Ÿค”

Why Coil is becoming more popular image loading library for android? ๐Ÿค”

If you are also a Glide lover like me, then you should look over the features of COIL.

Recently I came across this image loading library Coil which I saw was gaining much popularity. I was more curious because I was thinking about how it's giving competition to a library like Glide. And so I wanted to share my findings with you guys in a very summarized and a quick way! So without wasting any time, let's jump over its features.

Brief introduction to Coil๐Ÿ—ฃ๏ธ

Coil, according to their official documentation, stands for COroutine Image Loader, which is owned by Kotlin Coroutines (If you are not aware of Coroutines then refer this).

Key Features ๐Ÿ”ฅ

As we are moving towards modern android development practices, its important to keep ourselves updated with new tools and libraries. The points for which you can consider Coil over the most loved libraries like Glide, Picasso, or maybe Universal Image Loader(famously known as UIL) are:

  • Coil is light weighted. The library size is much less than Glide or other such libraries. (Coil - 94 Kb whereas Glide - 222 Kb and Fresco is 244 Kb).
  • It's very easy to use. As far as features are compared, Coil provides so many features, and it's so easy to use that a very beginner can easily implement this library.

Fast forwarding to its Implementation ๐Ÿง‘โ€๐Ÿ’ป

  1. Add the dependencies on your gradle file:

    implementation("io.coil-kt:coil:2.1.0")

  1. Now simply bind the image to your imageView as follows:

    • From a drawable: imageview.load(R.drawable.blog_image)

    • From a Network: imageview.load("https://blog-image.jpg")

    • From a File: imageview.load(File("/path/to/blog-image.jpg"))

Thats it, So simple right ๐Ÿ˜

Here this load() function is used to load the image to the imageView.

More features ๐Ÿคฉ

The functionality is not limited to load(). We can also extend this functions with lambda as shown below:

imageView.load("https://blog-image.jpg") {
    crossfade(true)
    placeholder(R.drawable.blog_image)
    transformations(CircleCropTransformation())
}

Want to know more about the Coil Usage and How to use it with jetpack Compose then Refer this.

So now you can compare how simple this library is as compared to Glide, or Picasso which has those long syntax like : Glide.with().load().into(). First provide the context, then the image then the view ๐Ÿ˜ช.

So what are you waiting for, just rush into your android studio and use Coil in your project ๐Ÿ˜Ž.

Hope you will enjoy reading this.

Thanks for reading.

Did you find this article valuable?

Support Subhadip Das by becoming a sponsor. Any amount is appreciated!

ย