On my Samsung Galaxy A54 5G device with Android 14 I am trying the camera2 API and to take image in YUV 420 format. Device only supports JPEG and YUV 420. I tried many of methods to convert from YUV 420 to RGBA bitmap and display/save it but no matter which method, all of them works more or less and returns a correct but a greenish image.
Among others I tried the below methods:
- Builtin RenderScript method ScriptIntrinsicYuvToRGB
- Android RenderScript Intrinscs Relpacement Toolkit which has a yuvToRgbBitmap conversion method
- Github method #1
- Camera2 samples method #1
- libyuv library’s Android420ToABGR method
As mentioned earlier, all of the above methods are returning a greenish (or yellowish) image, where the greenish is visible mostly on white/gray areas, like the below example taken with my dev app:
What I would expect as a correct conversion result is something very similar to the below reference screenshot: