hier ist mein CodeHaltebildausrichtung nach der Kompression
//
// reading an image captured using phone camera. Orientation of this
// image is always return value 6 (ORIENTATION_ROTATE_90) no matter if
// it is captured in landscape or portrait mode
//
Bitmap bmp = BitmapFactory.decodeFile(imagePath.getAbsolutePath());
//
// save as : I am compressing this image and writing it back. Orientation
//of this image always returns value 0 (ORIENTATION_UNDEFINED)
imagePath = new File(imagePath.getAbsolutePath().replace(".jpg", "_1.jpg"));
FileOutputStream fos0 = new FileOutputStream(imagePath);
boolean b = bmp.compress(CompressFormat.JPEG, 10, fos0);
fos0.flush();
fos0.close();
fos0 = null;
Nach der Kompression und Speicherung wird das Bild um 90 Grad gedreht, obwohl ExifInterface gibt 0 (ORIENTATION_UNDEFINED). Beliebiger Zeiger, wie kann ich die Ausrichtung des Quellbildes beibehalten? In diesem Fall ist es 6 (oder ORIENTATION_ROTATE_90).
danke.
danke Chintan für die Antwort. Was Sie gezeigt haben, ist nicht gerade mein Problem. Ich kenne die Orientierung. Das Problem ist, dass das gespeicherte Bild nach der Komprimierung immer automatisch um 90 Grad gedreht wird und 0 oder UNDEFINED zurückgibt, wenn es über ExifInterface abgefragt wird. Was ich will, ist die gleiche Ausrichtung des komprimierten Bildes beim Schreiben in die Datei. Ich hoffe, ich habe das Problem erklärt. – iuq