explaingit

coil-kt/coil

11,779KotlinAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Coil is a Kotlin image loading library for Android and Compose Multiplatform apps that fetches and displays remote images efficiently, with automatic memory caching, disk caching, scaling, and request cancellation built in.

Mindmap

mindmap
  root((coil))
    What It Does
      Remote image loading
      Automatic caching
      Request cancellation
    Key Features
      Memory cache
      Disk cache
      Auto image scaling
    API
      AsyncImage composable
      ImageLoader
      Transformations
    Platforms
      Android
      Compose Multiplatform
    Dependencies
      Kotlin Coroutines
      OkHttp or Ktor
      Okio
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Load and display a remote image in an Android Compose screen using a single AsyncImage composable.

USE CASE 2

Build a scrolling image gallery that automatically cancels in-flight image loads when items scroll off screen.

USE CASE 3

Cache product images in an e-commerce Android app to reduce data usage and make the UI feel faster.

USE CASE 4

Migrate an existing Android app from Glide or Picasso to a modern Kotlin-first library with Compose Multiplatform support.

Tech stack

KotlinCoroutinesOkioOkHttpJetpack ComposeAndroid

Getting it running

Difficulty · easy Time to first run · 30min

Requires adding OkHttp or Ktor as a networking dependency alongside Coil for image downloading to work.

Apache 2.0, use freely for any purpose including commercial Android apps, keep the license notice when distributing.

In plain English

Coil is an image loading library for Android apps and apps built with Compose Multiplatform, which is a toolkit for building apps that run on multiple platforms from shared Kotlin code. Its job is to fetch images from a URL and display them in your app efficiently, handling the complex parts of that process so you do not have to. The name is an acronym for Coroutine Image Loader. Coroutines are a Kotlin feature for handling background work, like downloading a file, without freezing the app's interface. Coil uses coroutines internally to load images without blocking the main thread. The README describes it as fast, lightweight, easy to use, and modern. In terms of performance, Coil caches images in memory and on disk, scales images down to the size they actually need to be shown at rather than loading full-resolution files, and automatically pauses or cancels image requests when they are no longer needed, for example when a user scrolls past a list item. These behaviors happen by default without you needing to configure them. The API is designed to stay out of your way. When using Compose, loading an image from a URL takes a single composable called AsyncImage, which you pass the image URL and a description. That is the entire integration for a basic setup. Additional configuration is available for caching policies, transformations, placeholder images, and error states. Coil depends only on Kotlin, Coroutines, and Okio (a small I/O library), plus an optional networking library like OkHttp or Ktor. It is licensed under the Apache 2.0 license and the full documentation is available on the project's website.

Copy-paste prompts

Prompt 1
Show me how to add Coil to an Android Compose project and display a remote image URL with a placeholder and an error fallback.
Prompt 2
Using Coil in Kotlin, apply a circular crop transformation and a blur effect to a user profile image loaded from a URL.
Prompt 3
My Coil image requests are slow on a low-memory device. Walk me through tuning its memory cache size and disk cache policy.
Prompt 4
How do I use Coil's ImageLoader to preload a list of image URLs in the background before the user scrolls to them?
Prompt 5
Set up Coil in a Compose Multiplatform project that targets both Android and iOS, using Ktor as the networking layer instead of OkHttp.
Open on GitHub → Explain another repo

← coil-kt on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.