Questions tagged [coil]

For questions about the Coil Android library, not generic coils

Filter by
Sorted by
Tagged with
60 votes
1 answer
25k views

Laggy Lazy Column Android Compose

I've created a whole app in Jetpack Compose. However, the performances on the Lazy Column are pretty bad and it does not make any sense. Lazy Column should be the substitution of RecyclerView, but ...
Mattia Ferigutti's user avatar
22 votes
2 answers
15k views

How to get bitmap from URL using Coil?

I want to load a bitmap from URL and then use palette API to get some colors from that. On the documentation page, I cannot find the code for getting bitmap directly! Can anyone help me out?
Chintan Parmar's user avatar
19 votes
3 answers
9k views

How to load remote SVG image using Coil in Jetpack Compose

I'm failing to load this image in Image using Coil in Jetpack Compose
Suman Radhakrishnan's user avatar
18 votes
4 answers
13k views

Auto Height Jetpack Compose Coil Image

I am trying to show an image with fill width and auto height using Jetpack Compose Coil. I want the image to take the full width and auto height. But the image only showing when I specify a fixed ...
Jeeva's user avatar
  • 4,415
15 votes
3 answers
7k views

Coil don't load image in emulator with Jetpack Compose

I need to show an image in my app by url using Coil, but this image don't load. I follow the official documentation https://coil-kt.github.io/coil/compose/. profile card implementation "io.coil-...
Gustavo Faria's user avatar
13 votes
3 answers
20k views

How to set an image URL as error placeholder on Coil in Jetpack Compose

Coil accepts a drawable resource as an error placeholder. Is there a way to use an image URL here instead? Here is the code I am working on: // Global variables var currentlySelectedImageUri = ...
Raw Hasan's user avatar
  • 1,246
13 votes
11 answers
15k views

PainterResource throws IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported

I am working on a Jetpack Project which downloads an image from API using Coil Library. I have confirmed that valid image URLs and related data are being returned from the API call successfully. I am ...
Tonnie's user avatar
  • 6,614
13 votes
2 answers
8k views

How to preload Coil image in Compose?

I have a pager (Accompanist) with image that are get from web with Coil in Compose. The rememberPainter() seem to only call the request when the Image composable is shown for the first time. So when I ...
Melio500's user avatar
  • 379
11 votes
5 answers
3k views

Showing a Progress bar while loading image using Coil?

How to show a progress bar while fetching image from URL in Coil.?
Unaisul Hadi's user avatar
10 votes
2 answers
7k views

Coil image caching not working with Jetpack Compose

I am using coil(version 2.1.0) to load images from URL. When there is network connection, the images are loading fine. However, when there is no network connection, the images are not being pulled ...
lokesh's user avatar
  • 851
9 votes
3 answers
16k views

How to load Image Files into Jetpack Compose Image using Coil

I want to load a local image file using Coil into a Jetpack Compose Image, but searching has produced only methods using web urls or by passing files converted to bitmaps. Can Coil load a local image ...
Vahid's user avatar
  • 1,668
9 votes
1 answer
8k views

Rounded corner only at top of image AysncImage Coil

I'm using the new AysncImage loader for compose inside a Box. The Box itself has a RoundedCornerShape. I have also added a RoundedCornerShape for the AsyncImage with the following values Box( ...
Sohail Shah's user avatar
9 votes
3 answers
7k views

Coil rememberAsyncImagePainter states are not updated

I use Coil along with Compose. And I'm trying to make a shimmer animation while the image is loading. All examples use ImagePainter with ImagePainter.State and it works correctly, but this is now ...
qveex's user avatar
  • 93
9 votes
4 answers
13k views

Coil ImageView doesn't fit exactly

According to Coils docs, I don't have to make any configuration for my image to fit(). The problem is, that the ImageView is not loading correctly: This is my configuration for the ImageView with ...
coroutineDispatcher's user avatar
8 votes
1 answer
16k views

How do I create a Jetpack Compose Image that resizes automatically based on a remotely loaded image size?

I would like to display an image with the following rules: The image is remote and needs to load on runtime. We don't know what the image size is until it's loaded. The Image view should take the ...
Eugene's user avatar
  • 3,866
8 votes
2 answers
9k views

Variable ImagePainter on Jetpack Compose

I'm working on an Android app using Jetpack Compose 1.0.0 and I'm trying to make a composable that uses a nullable image URL string and, if it's null, it will show a placeholder with painterResource ...
Matheus Dias's user avatar
7 votes
4 answers
7k views

How can I get a new image not cached in android coil?

I am developing an android app using the Jetpack Compose with Coil ImageLoader library. It shows a user's profile image. I receive the profile data from the API. GET: /users/{userId} The response ...
dev.farmer's user avatar
  • 2,621
6 votes
4 answers
9k views

Create a PDF Viewer in Jetpack Compose using PdfRenderer

I'm trying to create a PDF viewer composable using the PdfRenderer and Coil for loading the bitmaps into a LazyColumn. This is what I got so far: @Composable fun PdfViewer( modifier: Modifier = ...
Filippo Vigani's user avatar
6 votes
1 answer
8k views

How to load image using AsyncImage in jetpack compose with GrayScale transformation?

I am unable to achieve the grayscale transformation. Current code to load Image. AsyncImage( model = ImageRequest.Builder(LocalContext.current) .data(url) .crossfade(true) ....
Abhimanyu's user avatar
  • 13.3k
6 votes
1 answer
2k views

Android:Cache Validity for an Image using coil in jetpack

I am facing issue in setting validity for Cache in android jetpack using coil. What I Need: In Android Jetpack compose, I need to download an SVG image from the Url and store it to the cache. But the ...
CavinAndro's user avatar
6 votes
0 answers
2k views

how to make Compose Preview display image/vector resources loaded from web?

I use Coil to load .svg resources from the web, for example: @Composable fun Widget(modifier: Modifier = Modifier) { AsyncImage( modifier = Modifier.fillMaxSize(), model = ...
hescul's user avatar
  • 81
6 votes
1 answer
2k views

Add a shimmer while loading an image using coil and compose

Loading an image from a web URL and displaying a shimmer during load. Are there any better ways to handle this? val context = LocalContext.current val imageLoader = ImageLoader(context) val request = ...
svg's user avatar
  • 147
5 votes
4 answers
6k views

Loading local drawables with Coil Compose

I recently migrated from Accompanist's ImagePainter to Coil's, below is the pertinent code after my updates. val painter = rememberImagePainter(DRAWABLE_RESOURCE_ID) when (painter.state) { is ...
es0329's user avatar
  • 1,414
5 votes
1 answer
3k views

Image isn't being loaded by Coil Kotlin Jetpack Compose

I have this image I want to load, I am using coil in jetpack compose to try and load it yet it didn't load and just gave me an empty composable. Whenever I try to load a different image from any other ...
Sofa44's user avatar
  • 65
5 votes
2 answers
2k views

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 ...
Orwa kassab's user avatar
5 votes
2 answers
7k views

jetpack Compose with Coil not loading URL images

New to Jetpack Compose and Coil, but not new to Android or Java/Kotlin. I'm not able to show images from a URL...Something basic missing? I took the Google/Android tutorial from (https://developer....
Martin's user avatar
  • 4,741
5 votes
1 answer
2k views

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 ...
권오성's user avatar
4 votes
2 answers
4k views

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 ...
Pierre Vieira's user avatar
4 votes
1 answer
4k views

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 ...
MaxAstin's user avatar
  • 563
4 votes
1 answer
1k views

Compose - image recomposition

In my view model I have: var uri = savedStateHandle.getStateFlow("uri", Uri.EMPTY) private set In my view: val uri by viewModel.uri.collectAsState() Image( ...
RCH's user avatar
  • 1,279
4 votes
1 answer
6k views

How can i parse Uri String for loading image from gallery in jetpack compose with Coil?

Let say i have image components can show image from selected image from gallery; @Composable fun ClickableToGalleryImage() { var imageUri by remember { mutableStateOf<Uri?>(null) ...
commandiron's user avatar
  • 1,237
4 votes
5 answers
1k views

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 ...
H.Step's user avatar
  • 105
4 votes
1 answer
6k views

Kotlin AsyncImage Coil not caching images properly, keeps reloading each time

I'm using the Coil dependency, so I can harness AsyncImage. This is how I'm displaying my images: AsyncImage( model = ImageRequest.Builder(LocalContext.current) .data(img) ...
Sam Chahine's user avatar
4 votes
1 answer
344 views

Coil unit testing - how to do this?

Is it possible to mock coil network level when unit testing? With MockWebServer? Or test it somehow else? I can't find information on the Internet about it.
Vladimir Fisher's user avatar
4 votes
1 answer
1k views

Prioritise local cache over Network in Coil

I am using Coil with Jetpack compose. I noticed that in my LazyColumn items the images that load using coil(downloaded from the network) load faster when the device is offline ( this is once the ...
Anudeep Ananth's user avatar
4 votes
0 answers
769 views

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 ...
David's user avatar
  • 51
3 votes
3 answers
3k views

Coil: Loading indicator stacked on top of image instead of replacing image?

I am loading a photo into a Image with Jetpack Compose and Coil. I want to show a loading indicator when image is loading, that replaces the picture while it loads. However I can't manage to figure it ...
CJR's user avatar
  • 3,382
3 votes
3 answers
3k views

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 ...
Pierre Vieira's user avatar
3 votes
2 answers
2k views

Coil: Loading image from firebase not working - Unable to fetch data. No fetcher supports

Image( modifier = Modifier.size(100.dp).padding(16.dp), painter = rememberImagePainter( ImageRequest.Builder(LocalContext.current) // .data("https:/...
z.g.y's user avatar
  • 6,451
3 votes
3 answers
2k views

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) ...
nglauber's user avatar
  • 21.6k
3 votes
2 answers
5k views

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 ...
daniyelp's user avatar
  • 1,055
3 votes
1 answer
1k views

Coil AsyncImage not resolving

I have not been able to get Coil to resolve for me. I've added the implementation to my gradle implementation('io.coil-kt:coil:2.2.2') I've added import coil.* and I've tried import coil.compose....
Robert's user avatar
  • 998
3 votes
2 answers
2k views

Coil placeholder not showing if vectorpainter is used in jetpack compose

I am using the following code to display an image. AsyncImage( model = createImageUrl(audio.image_path), contentDescription = "Song Artwork", ...
Diken Mhrz's user avatar
3 votes
1 answer
2k views

Image ContentScale not applied correctly when Coil's Crossfade is set to true

I am using Coil to load a remote image in Jetpack Compose but I am facing a strange problem. Here is the code that I am working with: Column() { Image( painter = ...
Tonnie's user avatar
  • 6,614
3 votes
1 answer
3k views

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 ...
erluxman's user avatar
  • 18.8k
3 votes
2 answers
98 views

Items in Compose StaggeredGrid rearranging themselves when scrolling up

I have implemented a LazyVerticalStaggeredGrid which shows GIFs. The GIFs are displayed using the AsyncImage from Coil using a url from Giphy. The items asynchronously load into the grid without issue....
ligaevelina's user avatar
3 votes
1 answer
821 views

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 ...
E I's user avatar
  • 533
3 votes
1 answer
103 views

Can we somehow determine whether hardware acceleration will work on the device?

Hello I have Android app using Compose and Coil to load images. I noticed in Crashlytics that there is crash while trying to render bitmap using hardware acceleration Fatal Exception: java.lang....
Radim Janda's user avatar
3 votes
0 answers
843 views

AsyncImage in LazyColumn Kotlin Compose

I have a list of photos from the internet and I want to load them into a LazyColumn. The problem is that some of them are loading faster than others so the photos appear in random order. Here is the ...
Максим Зозуляк's user avatar
3 votes
2 answers
3k views

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 ...
Jeevan Rupacha's user avatar