Intent intent1 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);를 이용해서
기본 카메라를 열어 사진을 찍은 후에
저장을 하면 회전이 90도가 되어있습니다.
그래서 구글링을 통해서
public static int exifOrientationToDegrees(int exifOrientation) {
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
return 90;
} else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
return 180;
} else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
return 270;
}
return 0;
}
를 통해서 회전을 해서 setimageBitmap 하는것까진 성공했습니다.
(imageview에 찍은 사진을 뿌려줄때는 회전상태가 제대로 되어있습니다.)
제가 하려는 것은 찍은 사진 abcd.jpg라는 파일이 현재 90도 오른쪽으로 회전이 되어있으면
원래대로 만들어서 새로운 파일로 만들려고 합니다.
Bitmap selectedImage = BitmapFactory.decodeFile(bPath, opt);
try {
ExifInterface exif = new ExifInterface(bPath);
int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
int exifDegree = BitmapUtil.exifOrientationToDegrees(exifOrientation);
selectedImage = BitmapUtil.rotate(selectedImage, exifDegree);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
찍은 사진을 bitmapfactory로 불러와서 rotate를 돌려주는것은 했지만
이상태에서 다시 파일로 생성하려면 어떻게 해야하나요?