ImageProxy to Bitmap bug on Samsung Galaxy A24

46 views
Skip to first unread message

Michael Kostner

unread,
Feb 5, 2024, 2:02:16 PMFeb 5
to Android CameraX Discussion Group
Hi,

I am since long observing a bug affecting nearly exclusively the Samsung Galaxy A24, when transforming the imageProxy returned from onCaptureSuccess, into a Bitmap. I initially thought it was due to my own code, since I previously coded the transformation myself, however recently I have implemented CameraX's own .toBitmap() function, and the issue still persists. Below you can find the stack trace (I redacted some information with Xs for privacy reasons): 

Fatal Exception: java.lang.UnsupportedOperationException
Decode jpeg byte array failed

Fatal Exception: java.lang.UnsupportedOperationException: Decode jpeg byte array failed
       at androidx.camera.core.internal.utils.ImageUtil.createBitmapFromJpegImage(ImageUtil.java:453)
       at androidx.camera.core.internal.utils.ImageUtil.createBitmapFromImageProxy(ImageUtil.java:82)
       at androidx.camera.core.ImageProxy.toBitmap(ImageProxy.java:154)
       at com.xxx.xxx.xxx.utils.Utilities.imageProxyToBitmap(Utilities.java:842)
       at com.xxx.xxx.xxx.ui.fragment.xxxFragment$captureImage$1.onCaptureSuccess(xxxFragment.java:2867)
       at androidx.camera.core.imagecapture.TakePictureRequest.lambda$onResult$2(TakePictureRequest.java:200)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1012)


Is this a bug, or am I implementing something incorrectly here?

Kind regards, 
Michael

Scott Nien

unread,
Feb 5, 2024, 7:07:41 PMFeb 5
to Michael Kostner, Charcoal Chen, Android CameraX Discussion Group
This looks like the same issue as https://issuetracker.google.com/309005680

Charcoal,  do you think our workaround can also fix the in-memory capture case ? 



--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/e7572f9c-8280-49ca-bc35-82fbc974dcc6n%40android.com.

Charcoal Chen

unread,
Feb 5, 2024, 9:38:41 PMFeb 5
to Scott Nien, Michael Kostner, Android CameraX Discussion Group
Yes, our workaround can also fix the issue for in-memory capture.

Scott Nien

unread,
Feb 5, 2024, 11:07:17 PMFeb 5
to Charcoal Chen, Michael Kostner, Android CameraX Discussion Group
Hi, 

Samsung has a fix for the issue that is included in the latest FOTA(different regions might receive the FOTA build at different times). And as Charcoal said,  CameraX also has a workaround for the issue that MIGHT fix the issue, the workaround will be included in the March release. 
Reply all
Reply to author
Forward
0 new messages