1
我想將位圖保存爲.Jpg的存儲。用這種方法成功保存。如何將原始方向的位圖保存爲JPG圖像?
private void SaveImage(Bitmap finalBitmap) {
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/Dir");
String fname = "Image.jpg";
File file = new File (myDir, fname);
if (file.exists()) file.delete();
try {
FileOutputStream out = new FileOutputStream(file);
finalBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
但保存的圖像方向是90度clockwised。我想用原來的方向保存它。我該如何解決這個問題。請給我建議。謝謝。
有很多關於SO的帖子,你可以用一點谷歌搜索找到...看到[這個問題](http://stackoverflow.com/a/11081918/2668136)和[這個](http://stackoverflow.com/questions/25231148/android-camera-saving-images-with-wrong-orientation)爲例。 – Fllo
這個問題特別出現在棒棒糖之前的一些android api設備,當用相機捕捉並保存或使用時。他們應該相應地旋轉 – Androider
我想我應該使用shell命令來複制它。 –