这是我的代码
//
// reading an image captured using phone camera. Orientation of this
// image is always return value 6 (ORIENTATION_ROTATE_90) no matter if
// it is captured in landscape or portrait mode
//
Bitmap bmp = BitmapFactory.decodeFile(imagePath.getAbsolutePath());
//
// save as : I am compressing this image and writing it back. Orientation
//of this image always returns value 0 (ORIENTATION_UNDEFINED)
imagePath = new File(imagePath.getAbsolutePath().replace(".jpg", "_1.jpg"));
FileOutputStream fos0 = new FileOutputStream(imagePath);
boolean b = bmp.compress(CompressFormat.JPEG, 10, fos0);
fos0.flush();
fos0.close();
fos0 = null;
压缩和保存后,图像旋转 90 度,但 ExifInterface 返回 0 (ORIENTATION_UNDEFINED)。任何指针,我怎样才能保留源图像的方向;在这种情况下,它是 6(或 ORIENTATION_ROTATE_90)。
谢谢。