I suspects the format type.?
image.get_format() # Returns '4' in Godot no matter what i do
My plugin Kotlin code:
// Bitmap decode, tried both Alt.1 and Alt.2 with same result
//Alt.1
/*val source = ImageDecoder.createSource(godot.contentResolver, uri)
val bitmap = ImageDecoder.decodeBitmap(source)*/
//Alt. 2
val opt = BitmapFactory.Options()
opt.inPreferredConfig = Bitmap.Config.ARGB_8888
val inputImage = godot.contentResolver.openInputStream(uri)
val bitmap = BitmapFactory.decodeStream(inputImage, null, opt)!!
// Convert to ByteArray
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream)
stream.close()
// Return image as PoolByteArray to Godot
emitSignal("image_request_completed", stream.toByteArray())