Siddroid - your place to learn Kotlin and Android

Siddroid

Browse

Search

About

Uncoiling the Coil with Sagar Viradiya

  ·  4 min read

  ·  81 views


Event Details

Coil Image loading library for Android

Image loading is hard but luckily this problem has already been addressed on Android. There are many libraries out there that handle image loading seamlessly. COIL is the new kid to the club and you may be wondering why do we need another image loading library? COIL is Kotlin first library backed by Kotlin Coroutines. It gives you an easy and concise API to deal with image loading. Oh and also it takes less space! In a nutshell, it’s an easy-to-use, fast, lightweight, and modern library.

This talk will address

  • Why you should consider this library for image loading?
  • Understanding its API.
  • How it works? by covering its entire image loading pipeline. By the end, you’ll walk away with the advantages of using COIL and its image loading pipeline.

Recording

Q&A

We had over 25+ questions from the audience! Some we were able to address and Sagar has shared answers to the rest. Here are the questions:

You can also visit Youtube, the answers to the following questions are time-stamped directly in the video and can easily be found.

Questions

  • Why prefer Coil over Picasso, Glide?
  • If you are using RxJava extensively, what is your opinion of using COIL in a Rxified way?
  • Does Coil has built-in Compose support? or planning to? (I am aware of Accompanist)
  • I read “Coil performs a number of optimizations including memory and disk caching, downsampling, re-using bitmaps, etc”. Glide also does that, right? Why is it fast?
  • Does Coil has any plan to support KMP?
  • Any drawback of using Coil?
  • How is the performance of Coil wrt bitmap caching etc?
  • Is it possible to write custom Transformers?
  • When we use Picasso or glide we need to check if the URL string is not null/empty/ correct etc, does coil take care of this validation itself?
  • If an image is of high resolution and I only want to load the image according to the width/ height of ImageView, how can I transform that image before it’s shown?
  • How to load images in RecyclerView (i.e list) by keeping performance in mind? Like image dimension, time, etc.
  • Does Coil has built-in support for SVG? How Coil has handling image when API can return jpg, png, and SVG file also. It is automatically identified SVG and loading
  • If I want to load quite a lot of images, how do you think one should go about using predictive fetching to load those with Coil
  • Is BookMyShow using Coil?
  • Does coil support AVIF image format support that was announced in Android 12?
  • Does COIL support animated GIFs or APNGs?
  • Does COIL support Native NDK Image decoder which is available from Android 11 and is now fully supported in Android 12?
  • Can COIL be used with Jetbrains Compose on the desktop? Can it be used in headless mode?
  • Does Coil have both disk and in-memory cache?
  • Can GCP Kubernetes Pod instances be enabled with Kotlin’s lambda function in a browser app where COIL parameters have to be populated for AI/ML image types?
  • I have designed an android view in IntelliJ IDEA IDE with a basic Kotlin Gradle onCreateView() function. How fetcher interface can allocate GCP CLI in a region?
  • Will the slides be available later to refer back? (see description)
  • Can Coil upsample images for me? If yes, does it use something like nearest-neighbor interpolation or something else?
  • Is Coil a pure JVM library or only an Android library?

Other questions

Here are answers to some unanswered questions from the video that Sagar has shared with us.

If you are using RxJava extensively, what is your opinion of using COIL in an Rxified way?

In terms of Rx, I’d recommend using the Kotlin coroutines RxJava interop library

Does Coil has any plan to support KMP?

No plans to use KMP! Coil relies on a lot of Android-specific behaviour and APIs and it would be a huge effort to support it.

Any drawback of using Coil?

In terms of drawbacks, Coil doesn’t support 100% of Glide’s feature set (but has some features Glide doesn’t). Thumbnails, for instance, is one a lot of folks have requested.

Can Coil upsample images for me? If yes, does it use something like nearest-neighbor interpolation or something else?

Coil can and will upsample images in certain cases. It uses Android’s scaling algorithm which differs across API versions

On to the next one!

Thanks to everyone who attended the session. It was really fun and we can’t wait to do our next online meetup. It is going to be pretty interesting! Stay tuned for more and follow us on Twitter @KotlinMumbai

About the author

Siddhesh Patil is an Android Engineer at DeliveryHero. Building core ordering experiences at Foodpanda and Foodora. He is the organzier of Kotlin Mumbai, a developer community in Mumbai, India. Find talks, articles and latest developments in Android and Kotlin on this website siddroid.com

Sid Patil is an Android Engineer and Kotlin Advocate based in Berlin, Germany. He works at Delivery Hero, building ordering experiences of food delivery and Q-commerce brands like Foodpanda and Foodora.

This publication was last updated on November 23, 2021

Share on