사진촬영후 앨범에는 정면으로잘나타나있고. 제가 크롭하기전에 이미지를 이미지뷰에 띄어봤는데
베가는 정확하게정면으로 이미지뷰에 들어가는데요....
겔럭시는 이상하게 오른쪽으로 회전이 되어 나타나있습니다. 그리고 크롭을 따로 하는 소스로 연결하여서 보게되면
크롭이미지가 마찬가지로 회전이되어있네요. 기기마다달라서 촬영하고나서 불러오게될경우 화면이 회전이 된다는말이있더라고요 그래서 문제가 크롭하는 엑티비티 소스에 잘못이있는가 해서 소스를 한번 올려봅니다. 찍은그대로 이미지를 불러오고싶습니다. 소스첨부했습니다. 조언 부탁드립니다.
@SuppressLint("NewApi")
public void setImageBitmap(Bitmap bitmap, ExifInterface exif) {
if (bitmap == null) {
return;
}
if (exif == null) {
setImageBitmap(bitmap);
return;
}
final Matrix matrix = new Matrix();
final int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, 1);
int rotate = -1;
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_270:
rotate = 270;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
rotate = 90;
break;
}
if (rotate == -1) {
setImageBitmap(bitmap);
} else {
matrix.postRotate(rotate);
final Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0,
bitmap.getWidth(), bitmap.getHeight(), matrix, true);
setImageBitmap(rotatedBitmap);
bitmap.recycle();
}
}