最近在做一个相机功能 但是保存的图片jpg格式总是逆时针90度 怎么修改代码可以完善这个问题呢 谢谢各位高手了 网上搜了一些代码 用了下都不行 小弟菜鸟不知道是哪里的问题 谢谢好心人了
public boolean saveImage(Context mContext, byte[] imageData, int quality) {
// 创建File对象的储存路径
File path = new File("/sdcard");
int degree=0;
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 5;
Bitmap image = BitmapFactory.decodeByteArray(imageData, 0, imageData.length,options);
FileOutputStream fos = new FileOutputStream(path.toString() +"/image.jpg");
BufferedOutputStream bos = new BufferedOutputStream(fos);
// 图片格式JPEG
image.compress(CompressFormat.JPEG, quality, bos);
bos.flush();
bos.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public boolean saveImage(Context mContext, byte[] imageData, int quality) {
// 创建File对象的储存路径
File path = new File("/sdcard");
int degree=0;
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 5;
Bitmap image = BitmapFactory.decodeByteArray(imageData, 0, imageData.length,options);
FileOutputStream fos = new FileOutputStream(path.toString() +"/image.jpg");
BufferedOutputStream bos = new BufferedOutputStream(fos);
// 图片格式JPEG
image.compress(CompressFormat.JPEG, quality, bos);
bos.flush();
bos.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货