question: public static Bitmap convertYuvImageToBitmap ( @ NonNull final YuvImage yuvImage ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; yuvImage . compressToJpeg ( new Rect ( 0 , 0 , yuvImage . getWidth ( ) , yuvImage . getHeight ( ) ) , 100 , out ) ; byte [ ] imageBytes = out . toByteArray ( ) ; try { out . close ( ) ; } catch ( IOException e ) { Log . e ( LOG_TAG , "Exception while closing output stream" , e ) ; } return BitmapFactory . decodeByteArray ( imageBytes , 0 , imageBytes . length ) ; }
target:  Note: This conversion procedure is sloppy and may result in JPEG compression artifacts