Coil

Image loading for Android backed by Kotlin Coroutines.
Alternatives To Coil
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Kotlinx.coroutines11,9691,3398823 days ago98July 13, 2022258apache-2.0Kotlin
Library support for Kotlin coroutines
Coil9,21175 days ago43September 08, 202221apache-2.0Kotlin
Image loading for Android backed by Kotlin Coroutines.
Compressor6,557
9 months ago4March 22, 2021125Kotlin
An android image compression library.
Kotlin Coroutines And Flow Usecases On Android2,347
a month ago4apache-2.0Kotlin
🎓 Learning Kotlin Coroutines and Flows for Android by example. 🚀 Sample implementations for real-world Android use cases. 🛠 Unit tests included!
Splitties2,293124 days ago9August 20, 202148apache-2.0Kotlin
A collection of hand-crafted extensions for your Kotlin projects.
Ktx1,22927 hours ago32May 22, 20229cc0-1.0Kotlin
Kotlin extensions for the libGDX game framework
Paperplane1,135
5 years ago3apache-2.0Kotlin
📚 PaperPlane - An Android reading app, including articles from Zhihu Daily, Guokr Handpick and Douban Moment.
Flowbinding875133 months ago20July 04, 20216apache-2.0Kotlin
Kotlin Coroutines Flow binding APIs for Android's platform and unbundled UI widgets, inspired by RxBinding.
Kotlin Coroutines Retrofit768
263 years ago20February 11, 20193apache-2.0Kotlin
Kotlin Coroutines await() extension for Retrofit Call
Kord718
12 days ago18July 10, 202241mitKotlin
Idiomatic Kotlin Wrapper for The Discord API
Alternatives To Coil
Select To Compare


Alternative Project Comparisons
Readme

Coil

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.

Translations: , , Trke,

Download

Coil is available on mavenCentral().

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

Quick Start

ImageViews

To load an image into an ImageView, use the load extension function:

// URL
imageView.load("https://example.com/image.jpg")

// File
imageView.load(File("/path/to/image.jpg"))

// And more...

Requests can be configured with an optional trailing lambda:

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

Jetpack Compose

Import the Jetpack Compose extension library:

implementation("io.coil-kt:coil-compose:2.4.0")

To load an image, use the AsyncImage composable:

AsyncImage(
    model = "https://example.com/image.jpg",
    contentDescription = null,
)

Image Loaders

Both imageView.load and AsyncImage use the singleton ImageLoader to execute image requests. The singleton ImageLoader can be accessed using a Context extension function:

val imageLoader = context.imageLoader

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 ImageLoader instance(s):

val imageLoader = ImageLoader(context)

If you do not want the singleton ImageLoader, depend on io.coil-kt:coil-base instead of io.coil-kt:coil.

Requests

To load an image into a custom target, enqueue an ImageRequest:

val request = ImageRequest.Builder(context)
    .data("https://example.com/image.jpg")
    .target { drawable ->
        // Handle the result.
    }
    .build()
val disposable = imageLoader.enqueue(request)

To load an image imperatively, execute an ImageRequest:

val request = ImageRequest.Builder(context)
    .data("https://example.com/image.jpg")
    .build()
val drawable = imageLoader.execute(request).drawable

Check out Coil's full documentation here.

R8 / Proguard

Coil is fully compatible with R8 out of the box and doesn't require adding any extra rules.

If you use Proguard, you may need to add rules for Coroutines, OkHttp and Okio.

License

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.
Popular Coroutine Projects
Popular Kotlin Coroutines Projects
Popular Control Flow Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Kotlin
Coroutines
Okhttp
Kotlin Coroutines
Proguard
Imageloader