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
Albert Chang
06/02/2021, 8:29 AM
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
Zun
06/02/2021, 9:01 AM
Coil loads a cached image I believe
Zun
06/02/2021, 9:01 AM
@Albert Chang and how do you get the bitmap?
s
Superblazer
06/02/2021, 9:03 AM
@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?