public String saveImageToPath(byte[] data, Camera.Parameters parameters, String desPath) {
Camera.Size size = parameters.getPreviewSize();
String filePath = Environment.getExternalStorageDirectory().getPath() + desPath;
try {
data = rotateYUV90(data, size.width, size.height);
int rotatedHeight = size.width;
int rotatedWidth = size.height;
YuvImage image = new YuvImage(data, parameters.getPreviewFormat(),
rotatedWidth, rotatedHeight, null);
File file = new File(filePath);
if (!file.exists()) {
FileOutputStream fos = new FileOutputStream(file);
image.compressToJpeg(new Rect(0, 0, image.getWidth(), image.getHeight()), 90, fos);
}
} catch (FileNotFoundException e) {
}
return filePath;
}
Util.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:Ancaffe
作者:
评论列表
文章目录