3
我從我的肖像相機應用拍攝照片併發送到服務器。在發送之前,如果需要,我需要旋轉圖像。因此,我將圖像保存在SD卡中,並嘗試得到的Exif或Cursor.I通過最相關this.But什麼崗位的工作去爲me.Here是代碼..使用EXIF或光標圖像的方向始終爲0
ExifInterface
File imageFile = new File(uri.toString()); ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath()); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
這裏的方位是對於任何圖像始終爲0
Cusor
int orientation = 0; final String[] projection = new String[] { MediaStore.Images.Media.ORIENTATION }; final Cursor cursor = getApplicationContext() .getContentResolver().query(uri, projection, null, null, null); if (cursor != null) { final int orientationColumnIndex = cursor.getColumnIndex(MediaStore.Images.Media.ORIENTATION); if (cursor.moveToFirst()) { orientation = cursor.isNull(orientationColumnIndex) ? 0 : cursor.getInt(orientationColumnIndex); }
這裏也像旋轉是我zero.How可以找到圖片的確切旋轉?任何幫助將不勝感激..
對此有什麼好運?有類似的問題? – ono