nv21图片 转 bitmap

String path = Environment.getExternalStorageDirectory()+"/yub/32.yuv" ;
File file = new File(path);
InputStream is = new FileInputStream(file);
byte[] nv21Picture = getBytes(is);

YuvImage image = new YuvImage(nv21Picture, ImageFormat.NV21, 360, 720, null);
ByteArrayOutputStream os = new ByteArrayOutputStream(nv21Picture.length);
image.compressToJpeg(new Rect(0, 0, 360, 720), 100, os);
byte[] tmp = os.toByteArray();

Bitmap bitmap = BitmapFactory.decodeByteArray(tmp, 0,tmp.length);

猜你喜欢

转载自blog.csdn.net/chailongger/article/details/80570351