android frame to bitmap is null

Solutions on MaxInterview for android frame to bitmap is null by the best coders in the world

showing results for - "android frame to bitmap is null"
Martina
12 Apr 2020
1ByteArrayOutputStream out = new ByteArrayOutputStream();
2YuvImage yuvImage = new YuvImage(frame.getData(), ImageFormat.NV21, frame.getSize().getWidth(), frame.getSize().getHeight(), null);
3yuvImage.compressToJpeg(new Rect(0, 0, frame.getSize().getWidth(), frame.getSize().getHeight()), 90, out);
4byte[] imageBytes = out.toByteArray();
5Bitmap image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);