What is the best way to get the colors from an Ima...
# compose
s
What is the best way to get the colors from an Image Composable? I load the image with Coil from a url. In jetcaster example, they seem to Reload the image on touch to get the colors with palette api, how do I get the colors immediately instead without calling the url again?
a
You can load the bitmap, get the colors, and then call
bitmap.asImageBitmap()
to convert it to an
ImageBitmap
which can be used in your
Image
.
👍 1
z
Coil loads a cached image I believe
@Albert Chang and how do you get the bitmap?
s
@Albert Chang Accompanist Coil removed the ways to get a bitmap or drawable... Jetcaster does use Coil by itself just for this part, so should I directly use it?
👌 1
a
@Zun @Superblazer See Jetcaster example.
z
Oh I thought you found a way to get a bitmap from an already loaded image
👍 1