格式转换,根据API名字可以看到是用于转成jpeg格式
YuvImage yuv = new YuvImage(data, parameters.getPreviewFormat(), width, height, null); ByteArrayOutputStream out = new ByteArrayOutputStream(); yuv.compressToJpeg(new Rect(0, 0, width, height), 50, out); MyLog.e("onPreviewFrame() " + width+"x"+ height); byte[] bytes = out.toByteArray(); final Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);至于具体用法网上有
压缩API:
Bitmap newBit = Bitmap.createScaledBitmap(bitmap, 50, 40, true);
格式简陋,用于记录方便查阅。
参考文章:http://blog.csdn.net/u012005313/article/details/47299271