我正在构建一个相机应用程序,我正在以这种方式请求相机实例,预览以直角显示:
c = Camera.open();
c.setDisplayOrientation(90);
然而,在用户拍摄照片并将其加载到imageView后,它会逆时针旋转90度。这就是我保存照片的方式:
@Override
public void onPictureTaken(byte[] data, Camera camera) {
try {
String filePath = folderPath + generateFileName();
FileOutputStream outStream = new FileOutputStream( filePath );
outStream.write(data);
outStream.close();
// Put into imageView
File file = new File(filePath);
if(file.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
last_photo.setImageBitmap(myBitmap);
}
} catch (FileNotFoundException e) {
} catch (IOException e) {
} finally {
}
}
如何在不旋转图像的情况下保存图像?