I am using an AsyncImage to load a image in my composable and there is function which generates PDF. In that function I want to pass the result of AsyncImage as a Bitmap. I can get the painter object in onSucess call of Async Image.
AsyncImage(
model = imageUrl,
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.height(columnHeight.value),
contentScale = ContentScale.FillBounds,
fallback = fallbackImage,
error = fallbackImage,
placeholder = fallbackImage,
onSuccess = {
it.painter
}
)
I tried to search for a option to convert painter into Bitmap in compose and was not able to do it. I was wondering if there is way to either convert the painter to bitmap or if there is option to get the Bitmap after async image has loaded.
You can get it from
rememberAsyncImagePainter
asYou can also refer this answer
https://stackoverflow.com/a/74686650/5457853