3 回答

TA貢獻1784條經(jīng)驗 獲得超9個贊
這里有很多類似的主題和問題。由于您不是在編寫自己的相機,因此我認為可以歸結為:
一些設備在保存圖像之前先旋轉圖像,而其他設備只是在照片的exif數(shù)據(jù)中添加方向標簽。
我建議檢查照片的exif數(shù)據(jù),并特別尋找
ExifInterface exif = new ExifInterface(SourceFileName); //Since API Level 5
String exifOrientation = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
由于照片在您的應用程序中正確顯示,因此我不確定問題出在哪里,但這絕對可以使您走上正確的道路!

TA貢獻2021條經(jīng)驗 獲得超8個贊
我剛剛遇到了相同的問題,并使用它來糾正方向:
public void fixOrientation() {
if (mBitmap.getWidth() > mBitmap.getHeight()) {
Matrix matrix = new Matrix();
matrix.postRotate(90);
mBitmap = Bitmap.createBitmap(mBitmap , 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);
}
}
如果位圖的寬度大于高度,則返回的圖像為橫向,因此我將其旋轉90度。
希望它對這個問題有幫助。

TA貢獻1871條經(jīng)驗 獲得超8個贊
需要兩件事:
相機預覽需要與旋轉相同。設置這個camera.setDisplayOrientation(result);
將捕獲的圖片保存為相機預覽。通過執(zhí)行此操作Camera.Parameters。
int mRotation = getCameraDisplayOrientation();
Camera.Parameters parameters = camera.getParameters();
parameters.setRotation(mRotation); //set rotation to save the picture
camera.setDisplayOrientation(result); //set the rotation for preview camera
camera.setParameters(parameters);
希望能有所幫助。
- 3 回答
- 0 關注
- 502 瀏覽
添加回答
舉報