我正在使用 Android 的 Native Camera 应用程序拍照并将其保存在 sdcard 上。
Intent cameraintent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
cameraintent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
outputFileUri = Uri.fromFile(file);
startActivityForResult(cameraintent, CAMERA_REQUEST);
现在保存图像后,它似乎丢失了所有 EXIF 信息。当我尝试像这样检索 exif 信息时:
ExifInterface exif = new ExifInterface(Environment.getExternalStorageDirectory()+"/test.jpg");
String exifOrientation = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
它返回 exifOrientation = 0(即 ORIENTATION_UNDEFINED ),而它应该返回 6。
但是,此代码在其他 android 手机上运行良好(除了 Droid)。