Converting Uri to bitmap
I am trying to convert uri to bitmap using
val result = CropImage.getActivityResult(data)
val selectedImage = result.uri
val source = ImageDecoder.createSource(this.contentResolver, selectedImage)
val temp = ImageDecoder.decodeBitmap(source)
and i am getting an exception "java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps" while converting uri to bitmap. And the temp val is empty.
My android os version is O.
I tried this and it worked.
val result = CropImage.getActivityResult(data) val selectedImage = result.uri val options: BitmapFactory.Options = BitmapFactory.Options() options.inJustDecodeBounds = true if (selectedImage.path != null) { //Bitmap val outputBitmap = BitmapFactory.decodeFile(File(selectedImage.path!!).absolutePath, options) }
Hey!
I start a new project to handover this library https://github.com/CanHub/Android-Image-Cropper
The ideia is that we keep improving because this project don’t have updates since 2018
Hope I can count with your help.
Open to contribute, next pieces of work will be Android 11 permissions, refactor into Kotlin and ActivityContract