Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa

Viewed 292

In Android, I have an ImageReader which emits images onImageAvailable. I'm trying to forward those images to an ImageWriter to preview on a SurfaceView. When I attempt to do so, I receive the error stated above.

java.lang.IllegalStateException: Trying to attach an opaque image into a non-opaque ImageWriter, or vice versa

I looked around and I haven't found anyone else mention this issue. Does anyone know what it is talking about? The error seems to be in native code.

1 Answers

I just ran into this issue when trying to pass an Image from the camera into a Surface using ImageWriter. In my case, I fixed the problem by calling SurfaceHolder.setFormat() and passing in the same format that the camera Image is using.

Related