4

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.

hellowill89
  • 1,538
  • 2
  • 15
  • 26

1 Answers1

2

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.

Sam
  • 40,644
  • 36
  • 176
  • 219