- Important: Change the
CENTER
andMATRIX
ImageView
scale types to resolve toOriginalSize
. (#587)- This change only affects the implicit size resolution algorithm when the request's size isn't specified explicitly.
- This change was made to ensure that the visual result of an image request is consistent with
ImageView.setImageResource
/ImageView.setImageURI
. To revert to the old behaviour set aViewSizeResolver
when constructing your request.
- Important: Return the display size from
ViewSizeResolver
if the view's layout param isWRAP_CONTENT
. (#562)- Previously, we would only return the display size if the view has been fully laid out. This change makes the typical behaviour more consistent and intuitive.
- Add the ability to control alpha pre-multiplication. (#569)
- Support preferring exact intrinsic size in
CrossfadeDrawable
. (#585) - Check for the full GIF header including version. (#564)
- Add an empty bitmap pool implementation. (#561)
- Make
EventListener.Factory
a functional interface. (#575) - Stabilize
EventListener
. (#574) - Add
String
overload forImageRequest.Builder.placeholderMemoryCacheKey
. - Add
@JvmOverloads
to theViewSizeResolver
constructor. - Fix: Mutate start/end drawables in
CrossfadeDrawable
. (#572) - Fix: Fix GIF not playing on second load. (#577)
- Update Kotlin (1.4.20) and migrate to the
kotlin-parcelize
plugin. - Update Coroutines (1.4.1).
Changes since 0.13.0
:
- Add
Context.imageLoader
extension function. (#534) - Add
ImageLoader.executeBlocking
extension function. (#537) - Don't shutdown previous singleton image loader if replaced. (#533)
Changes since 1.0.0-rc3
:
- Fix: Guard against missing/invalid ActivityManager. (#541)
- Fix: Allow OkHttp to cache unsuccessful responses. (#551)
- Update Kotlin to 1.4.10.
- Update Okio to 2.9.0.
- Update
androidx.exifinterface:exifinterface
to 1.3.1.
- Revert using the
-Xjvm-default=all
compiler flag due to instability.- This is a source compatible, but binary incompatible change from previous release candidate versions.
- Add
Context.imageLoader
extension function. (#534) - Add
ImageLoader.executeBlocking
extension function. (#537) - Don't shutdown previous singleton image loader if replaced. (#533)
- Update AndroidX dependencies:
androidx.exifinterface:exifinterface
-> 1.3.0
- This release requires Kotlin 1.4.0 or above.
- All the changes present in 0.13.0.
- Depend on the base Kotlin
stdlib
instead ofstdlib-jdk8
.
- Important: Launch the Interceptor chain on the main thread by default. (#513)
- This largely restores the behaviour from
0.11.0
and below where the memory cache would be checked synchronously on the main thread. - To revert to using the same behaviour as
0.12.0
where the memory cache is checked onImageRequest.dispatcher
, setImageLoader.Builder.launchInterceptorChainOnMainThread(false)
. - See
launchInterceptorChainOnMainThread
for more information.
- This largely restores the behaviour from
- Fix: Fix potential memory leak if request is started on a
ViewTarget
in a detached fragment. (#518) - Fix: Use
ImageRequest.context
to load resource URIs. (#517) - Fix: Fix race condition that could cause subsequent requests to not be saved to the disk cache. (#510)
- Fix: Use
blockCountLong
andblockSizeLong
on API 18.
- Make
ImageLoaderFactory
a fun interface. - Add
ImageLoader.Builder.addLastModifiedToFileCacheKey
which allows you to enable/disable adding the last modified timestamp to the memory cache key for an image loaded from aFile
.
- Update Kotlin to 1.4.0.
- Update Coroutines to 1.3.9.
- Update Okio to 2.8.0.
- This release requires Kotlin 1.4.0 or above.
- Update Kotlin to 1.4.0 and enable
-Xjvm-default=all
.- See here for how to enable
-Xjvm-default=all
in your build file. - This generates Java 8 default methods for default Kotlin interface methods.
- See here for how to enable
- Remove all existing deprecated methods in 0.12.0.
- Update Coroutines to 1.3.9.
- Breaking:
LoadRequest
andGetRequest
have been replaced withImageRequest
:ImageLoader.execute(LoadRequest)
->ImageLoader.enqueue(ImageRequest)
ImageLoader.execute(GetRequest)
->ImageLoader.execute(ImageRequest)
ImageRequest
implementsequals
/hashCode
.
- Breaking: A number of classes were renamed and/or changed package:
coil.request.RequestResult
->coil.request.ImageResult
coil.request.RequestDisposable
->coil.request.Disposable
coil.bitmappool.BitmapPool
->coil.bitmap.BitmapPool
coil.DefaultRequestOptions
->coil.request.DefaultRequestOptions
- Breaking:
SparseIntArraySet
has been removed from the public API. - Breaking:
TransitionTarget
no longer implementsViewTarget
. - Breaking:
ImageRequest.Listener.onSuccess
's signature has changed to return anImageResult.Metadata
instead of just aDataSource
. - Breaking: Remove support for
LoadRequest.aliasKeys
. This API is better handled with direct read/write access to the memory cache.
- Important: Values in the memory cache are no longer resolved synchronously (if called from the main thread).
- This change was also necessary to support executing
Interceptor
s on a background dispatcher. - This change also moves more work off the main thread, improving performance.
- This change was also necessary to support executing
- Important:
Mappers
are now executed on a background dispatcher. As a side effect, automatic bitmap sampling is no longer automatically supported. To achieve the same effect, use theMemoryCache.Key
of a previous request as theplaceholderMemoryCacheKey
of the subsequent request. See here for an example.- The
placeholderMemoryCacheKey
API offers more freedom as you can "link" two image requests with different data (e.g. different URLs for small/large images).
- The
- Important: Coil's
ImageView
extension functions have been moved from thecoil.api
package to thecoil
package.- Use find + replace to refactor
import coil.api.load
->import coil.load
. Unfortunately, it's not possible to use Kotlin'sReplaceWith
functionality to replace imports.
- Use find + replace to refactor
- Important: Use standard crossfade if drawables are not the same image.
- Important: Prefer immutable bitmaps on API 24+.
- Important:
MeasuredMapper
has been deprecated in favour of the newInterceptor
interface. See here for an example of how to convert aMeasuredMapper
into anInterceptor
.Interceptor
is a much less restrictive API that allows for a wider range of custom logic.
- Important:
ImageRequest.data
is now not null. If you create anImageRequest
without setting its data it will returnNullRequestData
as its data.
- New: Add support for direct read/write access to an
ImageLoader
'sMemoryCache
. See the docs for more information. - New: Add support for
Interceptor
s. See the docs for more information. Coil'sInterceptor
design is heavily inspired by OkHttp's! - New: Add the ability to enable/disable bitmap pooling using
ImageLoader.Builder.bitmapPoolingEnabled
.- Bitmap pooling is most effective on API 23 and below, but may still be benificial on API 24 and up (by eagerly calling
Bitmap.recycle
).
- Bitmap pooling is most effective on API 23 and below, but may still be benificial on API 24 and up (by eagerly calling
- New: Support thread interruption while decoding.
- Fix parsing multiple segments in content-type header.
- Rework bitmap reference counting to be more robust.
- Fix WebP decoding on API < 19 devices.
- Expose FetchResult and DecodeResult in the EventListener API.
- Compile with SDK 30.
- Update Coroutines to 1.3.8.
- Update OkHttp to 3.12.12.
- Update Okio to 2.7.0.
- Update AndroidX dependencies:
androidx.appcompat:appcompat-resources
-> 1.2.0androidx.core:core-ktx
-> 1.3.1
- Breaking: This version removes all existing deprecated functions.
- This enables removing Coil's
ContentProvider
so it doesn't run any code at app startup.
- This enables removing Coil's
- Breaking: Convert
SparseIntArraySet.size
to a val. (#380) - Breaking: Move
Parameters.count()
to an extension function. (#403) - Breaking: Make
BitmapPool.maxSize
an Int. (#404)
- Important: Make
ImageLoader.shutdown()
optional (similar toOkHttpClient
). (#385)
- Reduce the default memory cache size to 20%. (#390)
- To restore the existing behaviour set
ImageLoaderBuilder.availableMemoryPercentage(0.25)
when creating yourImageLoader
.
- To restore the existing behaviour set
- Update Coroutines to 1.3.6.
- Update OkHttp to 3.12.11.
- Fix OOM when decoding large PNGs on API 23 and below. (#372).
- This disables decoding EXIF orientation for PNG files. PNG EXIF orientation is very rarely used and reading PNG EXIF data (even if it's empty) requires buffering the entire file into memory, which is bad for performance.
- Minor Java compatibility improvements to
SparseIntArraySet
.
- Update Okio to 2.6.0.
-
This version deprecates most of the DSL API in favour of using the builders directly. Here's what the change looks like:
// 0.9.5 (old) val imageLoader = ImageLoader(context) { bitmapPoolPercentage(0.5) crossfade(true) } val disposable = imageLoader.load(context, "https://www.example.com/image.jpg") { target(imageView) } val drawable = imageLoader.get("https://www.example.com/image.jpg") { size(512, 512) } // 0.10.0 (new) val imageLoader = ImageLoader.Builder(context) .bitmapPoolPercentage(0.5) .crossfade(true) .build() val request = LoadRequest.Builder(context) .data("https://www.example.com/image.jpg") .target(imageView) .build() val disposable = imageLoader.execute(request) val request = GetRequest.Builder(context) .data("https://www.example.com/image.jpg") .size(512, 512) .build() val drawable = imageLoader.execute(request).drawable
- If you're using the
io.coil-kt:coil
artifact, you can callCoil.execute(request)
to execute the request with the singletonImageLoader
.
- If you're using the
-
ImageLoader
s now have a weak reference memory cache that tracks weak references to images once they're evicted from the strong reference memory cache.- This means an image will always be returned from an
ImageLoader
's memory cache if there's still a strong reference to it. - Generally, this should make the memory cache much more predictable and increase its hit rate.
- This behaviour can be enabled/disabled with
ImageLoaderBuilder.trackWeakReferences
.
- This means an image will always be returned from an
-
Add a new artifact,
io.coil-kt:coil-video
, to decode specific frames from a video file. Read more here. -
Add a new EventListener API for tracking metrics.
-
Add ImageLoaderFactory which can be implemented by your
Application
to simplify singleton initialization.
- Important: Deprecate DSL syntax in favour of builder syntax. (#267)
- Important: Deprecate
Coil
andImageLoader
extension functions. (#322) - Breaking: Return sealed
RequestResult
type fromImageLoader.execute(GetRequest)
. (#349) - Breaking: Rename
ExperimentalCoil
toExperimentalCoilApi
. Migrate from@Experimental
to@RequiresOptIn
. (#306) - Breaking: Replace
CoilLogger
withLogger
interface. (#316) - Breaking: Rename destWidth/destHeight to dstWidth/dstHeight. (#275)
- Breaking: Re-arrange
MovieDrawable
's constructor params. (#272) - Breaking:
Request.Listener
's methods now receive the fullRequest
object instead of just its data. - Breaking:
GetRequestBuilder
now requires aContext
in its constructor. - Breaking: Several properties on
Request
are now nullable. - Behaviour change: Include parameter values in the cache key by default. (#319)
- Behaviour change: Slightly adjust
Request.Listener.onStart()
timing to be called immediately afterTarget.onStart()
. (#348)
- New: Add
WeakMemoryCache
implementation. (#295) - New: Add
coil-video
to support decoding video frames. (#122) - New: Introduce
EventListener
. (#314) - New: Introduce
ImageLoaderFactory
. (#311) - New: Support animated HEIF image sequences on Android 11. (#297)
- New: Improve Java compatibility. (#262)
- New: Support setting a default
CachePolicy
. (#307) - New: Support setting a default
Bitmap.Config
. (#342) - New: Add
ImageLoader.invalidate(key)
to clear a single memory cache item (#55) - New: Add debug logs to explain why a cached image is not reused. (#346)
- New: Support
error
andfallback
drawables for get requests.
- Fix: Fix memory cache miss when Transformation reduces input bitmap's size. (#357)
- Fix: Ensure radius is below RenderScript max in BlurTransformation. (#291)
- Fix: Fix decoding high colour depth images. (#358)
- Fix: Disable
ImageDecoderDecoder
crash work-around on Android 11 and above. (#298) - Fix: Fix failing to read EXIF data on pre-API 23. (#331)
- Fix: Fix incompatibility with Android R SDK. (#337)
- Fix: Only enable inexact size if
ImageView
has a matchingSizeResolver
. (#344) - Fix: Allow cached images to be at most one pixel off requested size. (#360)
- Fix: Skip crossfade transition if view is not visible. (#361)
- Deprecate
CoilContentProvider
. (#293) - Annotate several
ImageLoader
methods with@MainThread
. - Avoid creating a
LifecycleCoroutineDispatcher
if the lifecycle is currently started. (#356) - Use full package name for
OriginalSize.toString()
. - Preallocate when decoding software bitmap. (#354)
- Update Kotlin to 1.3.72.
- Update Coroutines to 1.3.5.
- Update OkHttp to 3.12.10.
- Update Okio to 2.5.0.
- Update AndroidX dependencies:
androidx.exifinterface:exifinterface
-> 1.2.0
- Fix: Ensure a view is attached before checking if it is hardware accelerated. This fixes a case where requesting a hardware bitmap could miss the memory cache.
- Update AndroidX dependencies:
androidx.core:core-ktx
-> 1.2.0
- Fix: Respect aspect ratio when downsampling in ImageDecoderDecoder. Thanks @zhanghai.
- Previously bitmaps would be returned from the memory cache as long as their config was greater than or equal to the config specified in the request. For example, if you requested an
ARGB_8888
bitmap, it would be possible to have aRGBA_F16
bitmap returned to you from the memory cache. Now, the cached config and the requested config must be equal. - Make
scale
anddurationMillis
public inCrossfadeDrawable
andCrossfadeTransition
.
- Fix: Translate child drawable inside
ScaleDrawable
to ensure it is centered. - Fix: Fix case where GIFs and SVGs would not fill bounds completely.
- Defer calling
HttpUrl.get()
to background thread. - Improve BitmapFactory null bitmap error message.
- Add 3 devices to hardware bitmap blacklist. (#264)
- Update AndroidX dependencies:
androidx.lifecycle:lifecycle-common-java8
-> 2.2.0
- Fix: Fix decoding GIFs on pre-API 19. Thanks @mario.
- Fix: Fix rasterized vector drawables not being marked as sampled.
- Fix: Throw exception if Movie dimensions are <= 0.
- Fix: Fix CrossfadeTransition not being resumed for a memory cache event.
- Fix: Prevent returning hardware bitmaps to all target methods if disallowed.
- Fix: Fix MovieDrawable not positioning itself in the center of its bounds.
- Remove automatic scaling from CrossfadeDrawable.
- Make
BitmapPool.trimMemory
public. - Wrap AnimatedImageDrawable in a ScaleDrawable to ensure it fills its bounds.
- Add @JvmOverloads to RequestBuilder.setParameter.
- Set an SVG's view box to its size if the view box is not set.
- Pass state and level changes to CrossfadeDrawable children.
- Update OkHttp to 3.12.8.
- Fix: Fix crash when calling
LoadRequestBuilder.crossfade(false)
.
- Breaking:
Transformation.transform
now includes aSize
parameter. This is to support transformations that change the size of the outputBitmap
based on the size of theTarget
. Requests with transformations are now also exempt from image sampling. - Breaking:
Transformation
s are now applied to any type ofDrawable
. Before,Transformation
s would be skipped if the inputDrawable
was not aBitmapDrawable
. Now,Drawable
s are rendered to aBitmap
before applying theTransformation
s. - Breaking: Passing
null
data toImageLoader.load
is now treated as an error and callsTarget.onError
andRequest.Listener.onError
with aNullRequestDataException
. This change was made to support setting afallback
drawable if data isnull
. Previously the request was silently ignored. - Breaking:
RequestDisposable.isDisposed
is now aval
.
- New: Support for custom transitions. See here for more info. Transitions are marked as experimental as the API is incubating.
- New: Add
RequestDisposable.await
to support suspending while aLoadRequest
is in progress. - New: Support setting a
fallback
drawable when request data is null. - New: Add
Precision
. This makes the size of the outputDrawable
exact while enabling scaling optimizations for targets that support scaling (e.g.ImageViewTarget
). See its documentation for more information. - New: Add
RequestBuilder.aliasKeys
to support matching multiple cache keys.
- Fix: Make RequestDisposable thread safe.
- Fix:
RoundedCornersTransformation
now crops to the size of the target then rounds the corners. - Fix:
CircleCropTransformation
now crops from the center. - Fix: Add several devices to the hardware bitmap blacklist.
- Fix: Preserve aspect ratio when converting a Drawable to a Bitmap.
- Fix: Fix possible memory cache miss with
Scale.FIT
. - Fix: Ensure Parameters iteration order is deterministic.
- Fix: Defensive copy when creating Parameters and ComponentRegistry.
- Fix: Ensure RealBitmapPool's maxSize >= 0.
- Fix: Show the start drawable if CrossfadeDrawable is not animating or done.
- Fix: Adjust CrossfadeDrawable to account for children with undefined intrinsic size.
- Fix: Fix
MovieDrawable
not scaling properly.
- Update Kotlin to 1.3.61.
- Update Kotlin Coroutines to 1.3.3.
- Update Okio to 2.4.3.
- Update AndroidX dependencies:
androidx.exifinterface:exifinterface
-> 1.1.0
- Breaking:
SvgDrawable
has been removed. Instead, SVGs are now prerendered toBitmapDrawable
s bySvgDecoder
. This makes SVGs significantly less expensive to render on the main thread. AlsoSvgDecoder
now requires aContext
in its constructor. - Breaking:
SparseIntArraySet
extension functions have moved to thecoil.extension
package.
- New: Support setting per-request network headers. See here for more info.
- New: Add new
Parameters
API to support passing custom data through the image pipeline. - New: Support individual corner radii in RoundedCornersTransformation. Thanks @khatv911.
- New: Add
ImageView.clear()
to support proactively freeing resources. - New: Support loading resources from other packages.
- New: Add
subtractPadding
attribute to ViewSizeResolver to enable/disable subtracting a view's padding when measuring. - New: Improve HttpUrlFetcher MIME type detection.
- New: Add Animatable2Compat support to MovieDrawable and CrossfadeDrawable.
- New: Add
RequestBuilder<*>.repeatCount
to set the repeat count for a GIF. - New: Add BitmapPool creation to the public API.
- New: Annotate Request.Listener methods with
@MainThread
.
- Fix: Make CoilContentProvider visible for testing.
- Fix: Include night mode in the resource cache key.
- Fix: Work around ImageDecoder native crash by temporarily writing the source to disk.
- Fix: Correctly handle contact display photo uris.
- Fix: Pass tint to CrossfadeDrawable's children.
- Fix: Fix several instances of not closing sources.
- Fix: Add a blacklist of devices with broken/incomplete hardware bitmap implementations.
- Compile against SDK 29.
- Update Kotlin Coroutines to 1.3.2.
- Update OkHttp to 3.12.6.
- Update Okio to 2.4.1.
- Change
appcompat-resources
fromcompileOnly
toimplementation
forcoil-base
.
- Breaking:
ImageLoaderBuilder.okHttpClient(OkHttpClient.Builder.() -> Unit)
is nowImageLoaderBuilder.okHttpClient(() -> OkHttpClient)
. The initializer is also now called lazily on a background thread. If you set a customOkHttpClient
you must setOkHttpClient.cache
to enable disk caching. If you don't set a customOkHttpClient
, Coil will create the defaultOkHttpClient
which has disk caching enabled. The default Coil cache can be created usingCoilUtils.createDefaultCache(context)
. e.g.:
val imageLoader = ImageLoader(context) {
okHttpClient {
OkHttpClient.Builder()
.cache(CoilUtils.createDefaultCache(context))
.build()
}
}
- Breaking:
Fetcher.key
no longer has a default implementation. - Breaking: Previously, only the first applicable
Mapper
would be called. Now, all applicableMapper
s will be called. No API changes. - Breaking: Minor named parameter renaming:
url
->uri
,factory
->initializer
.
- New:
coil-svg
artifact, which has anSvgDecoder
that supports automatically decoding SVGs. Powered by AndroidSVG. Thanks @rharter. - New:
load(String)
andget(String)
now accept any of the supported Uri schemes. e.g. You can now doimageView.load("file:///path/to/file.jpg")
. - New: Refactor ImageLoader to use
Call.Factory
instead ofOkHttpClient
. This allows lazy initialization of the networking resources usingImageLoaderBuilder.okHttpClient { OkHttpClient() }
. Thanks @ZacSweers. - New:
RequestBuilder.decoder
to explicitly set the decoder for a request. - New:
ImageLoaderBuilder.allowHardware
to enable/disable hardware bitmaps by default for an ImageLoader. - New: Support software rendering in ImageDecoderDecoder.
- Fix: Multiple bugs with loading vector drawables.
- Fix: Support WRAP_CONTENT View dimensions.
- Fix: Support parsing EXIF data longer than 8192 bytes.
- Fix: Don't stretch drawables with different aspect ratios when crossfading.
- Fix: Guard against network observer failing to register due to exception.
- Fix: Fix divide by zero error in MovieDrawable. Thanks @R12rus.
- Fix: Support nested Android asset files. Thanks @JaCzekanski.
- Fix: Guard against running out of file descriptors on Android O and O_MR1.
- Fix: Don't crash when disabling memory cache. Thanks @hansenji.
- Fix: Ensure Target.cancel is always called from the main thread.
- Update Kotlin to 1.3.50.
- Update Kotlin Coroutines to 1.3.0.
- Update OkHttp to 3.12.4.
- Update Okio to 2.4.0.
- Update AndroidX dependencies to the latest stable versions:
androidx.appcompat:appcompat
-> 1.1.0androidx.core:core-ktx
-> 1.1.0androidx.lifecycle:lifecycle-common-java8
-> 2.1.0
- Replace
appcompat
withappcompat-resources
as an optionalcompileOnly
dependency.appcompat-resources
is a much smaller artifact.
- New: Add
transformations(List<Transformation>)
to RequestBuilder. - Fix: Add the last modified date to the cache key for file uris.
- Fix: Ensure View dimensions are evaluated to at least 1px.
- Fix: Clear MovieDrawable's canvas between frames.
- Fix: Open assets correctly.
- Initial release.