Questions tagged [coil]

For questions about the Coil Android library, not generic coils

Coil is a fast, lightweight, easy to use and modern image loading library for Android backed by Kotlin Coroutines.
Coil is an acronym for: Coroutine Image Loader.
The library is currently developed and manteined by Instacart, and is under the Apache License, Version 2.0.

References

148 questions
3
votes
2 answers

Unresolved reference: compose in "coil.compose.AsyncImage"

I am trying to import the coil image library inside a composable function using import coil.compose.AsyncImage and implementation("io.coil-kt:coil:2.2.2") but Android Studio can't recognize the 'compose' and returns Unresolved reference: compose I…
Orwa kassab
  • 111
  • 1
  • 9
3
votes
3 answers

How to unit test if an image was loaded using Coil + Compose

I'm loading an image using Coil for Compose like below. @Composable fun SvgImageSample() { val painter = rememberAsyncImagePainter( model = ImageRequest.Builder(LocalContext.current) .decoderFactory(SvgDecoder.Factory()) …
3
votes
2 answers

Not able to display svg format image in jetpack compose

I tried to display svg image in my project but some of the file works but throws the error.. I tried with the coil library too but it doesn't show anything. While using Image compose with painterResource throws the follwing error:- compose…
3
votes
1 answer

How to draw border depending of color of loaded image?

I load the image by url using the coil library. After loading I need to draw a border around the image depending of background color of uploaded picture. For example, if I loaded the picture with white background, I need to set black border. val…
E I
  • 501
  • 4
  • 13
3
votes
0 answers

Android Compose, How to play animated webp only once with coil?

I was successful show animated webp using coil on image composable. However, my goal is to only run this animated webp once. Now it is repeating infinitely. Is there a way? Is my code. animated webp class MainActivity : ComponentActivity() { val…
권오성
  • 31
  • 4
3
votes
1 answer

Coil Compose Image Caching with Credential

I'm developing app to display the list of private images using Coil compose image loader. Coil has by default image caching enabled or we can also control caching policy for image urls which don't require credentials. How can I do image caching for…
3
votes
1 answer

Coil image caching

I load my images into an android app with the Coil library. And it instantly shows me cached images if there is no internet. But when there is an internet connection, the Coil loads images again, and for a while I see the placeholder. I think it's a…
MaxAstin
  • 463
  • 5
  • 14
3
votes
2 answers

Jetpack Compose: Get a callback when the image has finished loading with Coil

I'm loading a pretty large resource image using Coil for Jetpack Compose and it takes some tens of milliseconds to load, even hundreds when the screen is loaded for the first time. I want to not display some parts of the screen if the image isn't…
daniyelp
  • 915
  • 1
  • 11
  • 26
3
votes
2 answers

How to show a custom composable placeholder using Coil in Jetpack Compose?

I need to show a custom placeholder in Jetpack Compose using Coil, but that placeholder is not a drawable, it is a composable function that I customized. Is it possible to do this with the Coil? This is the code snippet where I use the Coil: Image( …
Pierre Vieira
  • 2,252
  • 4
  • 21
  • 41
3
votes
2 answers

How to use `ImageRequest.Builder.target` in the new coil version in jetpack compose?

My Gradle // Coil implementation "io.coil-kt:coil-compose:1.4.0" Problem Description Previously I used the coil together with Google's accompanist, but when I migrate to the new version of the coil as the documentation suggests I'm having problems…
Pierre Vieira
  • 2,252
  • 4
  • 21
  • 41
3
votes
3 answers

How to share HttpClient between Multiplatform Ktor and Coil?

I want to use Coil image library to load images from the api with the same cookie that was set before. Therefore I want to use the same HttpClient both for my Ktor networking calls and for Image Loading with Coil. How can I share the same HttpClient…
3
votes
1 answer

Coil Image Loader : Cache Bitmap with a key

I am using Coil Image loading library. My Problem: I am not getting image Url from backend, rather I am getting JPEG encoded String with its name / key. What I was wondering is if there is any inbuilt support for caching bitmap with respect to a…
erluxman
  • 18,155
  • 20
  • 92
  • 126
2
votes
0 answers

Jetpack Compose LazyVerticalGrid + coil lag

So i'm using LazyVertialGrid alongside coil to display some images, i have 3 fixed columns but whenever i scroll it gets pretty stuttery, almost unusable. Am i doing something wrong or missing something? I tried release mode, and lowering coil…
David
  • 21
  • 2
2
votes
1 answer

Image scale using aspect ratio coil using jetpack compose

I need to display image from uri/filepath, big image 1300x1600 resolution. Need to maintain aspect ratio. i tried with coil but didn't give desirable result, still shows big image. not sure whats wrong here what i tried val painter = …
2
votes
1 answer

Get bitmap before using in a Composable with Coil

I'm trying to get two images from an url and then I have a Composable that needs two bitmaps to draw them in a Canvas, I've tried it but the canvas don't get painted am I missing something? val overlayImage = …
1 2
3
9 10