Android Camera2 API YUV_420_888 to JPEG
I'm getting preview frames using OnImageAvailableListener : @Override public void onImageAvailable(ImageReader reader) { Image image = null; try { image = reader.acquireLatestImage(); Image.Plane[] planes = image.getPlanes(); ByteBuffer buffer = planes[0].getBuffer(); byte[] data = new byte[buffer.capacity()]; buffer.get(data); //data.length=332803; width=3264; height=2448 Log.e(TAG, "data.length=" + data.length + "; width=" + image.getWidth() + "; height=" + image.getHeight()); //TODO data processing } catch (Exception e) { e.printStackTrace(); } if (image != null) { image.close(); } } Each