Jetpack Compose not capturing rememberImagePainter in screenshot

I’m using the below code from this answer to draw my composable function to a canvas which in turn saves the image to the users phone which works fine, until I use rememberImagePainter in my Image composable and doesn’t give me any error message when the app crashes.

val bounds = capturingViewBounds ?: return@clickable
bitmap = Bitmap.createBitmap(
    bounds.width.roundToInt(), bounds.height.roundToInt(),
).applyCanvas {

I’m loading a PNG image from the web directly into this Image composable based on an if statement. If I use a normal drawable from my folder on the image, there’s no issue, it just seems to be when i load an image from the web it crashes

    modifier = Modifier
    painter = if (player.playerImageUrl.isNotBlank()) {
        rememberImagePainter(data = player.playerImageUrl)
    } else {
            id = setKitColour(kitColour)
    contentDescription = null
private fun setKitColour(color: String): Int {
    return when (color) {
        "Red" -> R.drawable.ic_shirt_red
        "Blue" -> R.drawable.ic_shirt_blue
        "Green" -> R.drawable.ic_shirt_green
        "Yellow" -> R.drawable.ic_shirt_yellow
        "White" -> R.drawable.ic_shirt_white
        else -> R.drawable.ic_shirt_black

enter image description here


doesn’t give me any error message when the app crashes

This is not the case, at least in my case I got the following exception:

java.lang.IllegalArgumentException: Software rendering doesn’t support hardware bitmaps

Which is a known problem in Coil, and can be fixed by specifying allowHardware(false):

        data = player.playerImageUrl,
        builder = {
    contentDescription = "..."