Image Rotation Error In Front And Rear Device Camera Photo Capture Intent
HI i have used the following device camera intent to capture and save the image in device storage: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); file
Solution 1:
Some cameras will actually store JPEG images in the proper rotation; others will set an EXIF header asking the image viewer to rotate the image. ImageView
does not honor EXIF headers in JPEG files. You will need to use ExifInterface
(or similar techniques) to see if there is an EXIF orientation header and adjust your image to suit.
Solution 2:
i have used the below code to check orientation and changed my imageview rotation to that angle
ExifInterface exif;
try {
exif = newExifInterface(filePath);
intorientation= exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, 0);
Log.d("EXIF", "Exif: " + orientation);
Matrixmatrix=newMatrix();
if (orientation == 6) {
matrix.postRotate(90);
Log.d("EXIF", "Exif: " + orientation);
} elseif (orientation == 3) {
matrix.postRotate(180);
Log.d("EXIF", "Exif: " + orientation);
} elseif (orientation == 8) {
matrix.postRotate(270);
Log.d("EXIF", "Exif: " + orientation);
}
Post a Comment for "Image Rotation Error In Front And Rear Device Camera Photo Capture Intent"