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 painter =
rememberAsyncImagePainter(
ImageRequest.Builder(LocalContext.current)
.data(data = imageUrl)
.apply(block = fun ImageRequest.Builder.() {
crossfade(true)
allowHardware(false)
}).build()
)
val painterState = painter.state
Image(
painter = painter,
contentDescription = null,
modifier = Modifier
.padding(start = 20.dp, top = 20.dp)
.width(130.dp)
.height(68.dp)
)
When painter.state is Succes, i'm picking the color of loaded drawable with Palette library.
How can I access to image after successful loading and draw the border in needed color?