I read the image from the gallery, then put it in the ImageView, everything is correct. However, when I try to change a pixel, I get this error. Moreover, this error occurs when an image is selected not from the camera, but, for example, from screenshots. If taken from downloads, it works correctly. With what it can be connected? The image itself is stored in Bitmap.
1 answer
From the Bitmap.setPixel(int, int, int) documentation:
Throws
IllegalStateExceptionif the bitmap is not mutableIllegalArgumentExceptionif x, y are outside of the bitmap's bounds.
You have a bitmap immutable, you can create a variable copy by the method:
Bitmap mutable = bitmap.copy(Bitmap.Config.ARGB_8888, true);
|