https://kotlinlang.org logo
#compose
Title
# compose
p

PHondogo

10/13/2022, 8:36 AM
Hello! How can I make image from byte array?
K 1
m

Michael Paus

10/13/2022, 9:19 AM
Is that what you are looking for? This assumes the bytes contain the encoded image data of a PNG, JPG, etc.
Copy code
fun imageBitmapFromBytes(encodedImageData: ByteArray): ImageBitmap {
    return BitmapFactory.decodeByteArray(encodedImageData, 0, encodedImageData.size).asImageBitmap()
}
p

PHondogo

10/13/2022, 6:03 PM
That is exactly what i was looking for. Thanks Michael!
827 Views