An image loading library for Android backed by Kotlin Coroutines. Coil is:
- Fast: Coil performs a number of optimizations including memory and disk caching, downsampling the image in memory, automatically pausing/cancelling requests, and more.
- Lightweight: Coil adds ~2000 methods to your APK (for apps that already use OkHttp and Coroutines), which is comparable to Picasso and significantly less than Glide and Fresco.
- Easy to use: Coil's API leverages Kotlin's language features for simplicity and minimal boilerplate.
- Modern: Coil is Kotlin-first and uses modern libraries including Coroutines, OkHttp, Okio, and AndroidX Lifecycles.
Coil is an acronym for: Coroutine Image Loader.
Coil is available on
To load an image into an
ImageView, use the
load extension function:
Requests can be configured with an optional trailing lambda:
Import the Jetpack Compose extension library:
To load an image, use the
AsyncImage use the singleton
ImageLoader to execute image requests. The singleton
ImageLoader can be accessed using a
Context extension function:
ImageLoaders are designed to be shareable and are most efficient when you create a single instance and share it throughout your app. That said, you can also create your own
If you do not want the singleton
ImageLoader, depend on
io.coil-kt:coil-base instead of
To load an image into a custom target,
To load an image imperatively,
R8 / Proguard¶
Coil is fully compatible with R8 out of the box and doesn't require adding any extra rules.
Copyright 2023 Coil Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.