Skip to content
Image loading for Android backed by Kotlin Coroutines.
Kotlin Other
  1. Kotlin 98.4%
  2. Other 1.6%
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Prepare 0.6.1. Aug 16, 2019
buildSrc Prepare 0.7.0. Aug 14, 2019
coil-base Guard against network observer failing to register due to exception. (#… Aug 20, 2019
coil-default Set up Travis CI. (#1) Aug 11, 2019
coil-gif Fix divide by zero error in MovieDrawable. (#45) Aug 19, 2019
coil-sample Use on Call.Factory instead of OkHttpClient. (#8) Aug 19, 2019
docs Prepare 0.6.1. Aug 16, 2019
gradle/wrapper Update Gradle to 5.6. Aug 16, 2019
.editorconfig Update ktlint. Aug 16, 2019
.gitignore Initial public release. Aug 10, 2019
.travis.yml Enable instrumentation tests on Travis CI. (#41) Aug 18, 2019
CHANGELOG.md Update CHANGELOG.md Aug 16, 2019
CONTRIBUTING.md Initial public release. Aug 10, 2019
LICENSE.txt Add license. Aug 10, 2019
README.md Prepare 0.6.1. Aug 16, 2019
SECURITY.md Documentation fix. Aug 11, 2019
android_wait_for_emulator.sh Enable instrumentation tests on Travis CI. (#41) Aug 18, 2019
build.gradle.kts Update ktlint. Aug 16, 2019
deploy_docs.sh Copy files when deploying docs. Aug 11, 2019
gradle.properties Enable instrumentation tests on Travis CI. (#41) Aug 18, 2019
gradlew Initial public release. Aug 10, 2019
gradlew.bat Initial public release. Aug 10, 2019
install_archives.sh Initial public release. Aug 10, 2019
logo.svg Initial public release. Aug 10, 2019
mkdocs.yml Initial public release. Aug 10, 2019
settings.gradle.kts Initial public release. Aug 10, 2019
test.sh Enable instrumentation tests on Travis CI. (#41) Aug 18, 2019
upload_archives.sh Initial public release. Aug 10, 2019

README.md

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, re-using Bitmaps, automatically pausing/cancelling requests, and more.
  • Lightweight: Coil adds ~1500 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.

Made with ❤️ at Instacart.

Download

Coil is available on mavenCentral().

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

Quick Start

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

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

// Resource
imageView.load(R.drawable.image)

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

// And more...

Requests can be configured with an optional trailing lambda:

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

To get an image imperatively, use the get suspend function:

val drawable = Coil.get("https://www.example.com/image.jpg")

Check out Coil's full documentation here.

Requirements

  • AndroidX
  • Min SDK 14+
  • Compile SDK: 28+
  • Java 8+

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 2019 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.
You can’t perform that action at this time.