照片成功地用相機拍攝,但在三星Galaxy S3的肖像模式下,圖片旋轉。我該如何解決這個問題。 相機意圖如下:以相機意圖旋轉照片在人像模式下旋轉android
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(xdestination));
startActivityForResult(intent, CAMERA_PIC_REQUEST);
在活動結果
if (requestCode==CAMERA_PIC_REQUEST){
// Bitmap bm = (Bitmap) data.getExtras().get("data");
Uri photo_uri = Uri.fromFile(xdestination);
Editer.PHOTO_FROM=11;
Bitmap decodeSampledBitmapFromFile=null;
try {
decodeSampledBitmapFromFile = decodeUri(photo_uri);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
decodeSampledBitmapFromFile.compress(Bitmap.CompressFormat.JPEG,100, bytes);
File f = new File(Environment.getExternalStorageDirectory(), "user_image.jpg");
try {
if(f.exists())
f.delete();
f.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
fo.close();
} catch (IOException e) {
e.printStackTrace();
Log.d("ERROR", e.toString());
}
}
我也有一個相同的問題,我捕捉它後旋轉圖片。 – InnocentKiller
你能告訴我你是如何旋轉圖片的嗎?發佈你的代碼如果可能或部分 – user3115198
嘗試我的下面的代碼,讓我知道它是否適合你。 – InnocentKiller