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 bitmap
s.
Can Coil
load a local image file directly into a Compose Image
?
For the new version of coil 2.2.2, rememberImagePainter
didn't give me good results so I used this-
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(<file_path>)
.build(),
contentDescription = "icon",
contentScale = ContentScale.Inside,
modifier = Modifier.size(30.dp)
)
Hope it helps someone