Helo community,
I've got a problem. Please help me.
I chosse a picture from intent like this:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)
try {
// We need to recyle unused bitmaps
if (bitmap != null) {
bitmap.recycle();
}
InputStream stream = null;
try {
// Von Gallerie
System.out.println("Test A1");
Bitmap bitmap = null;
stream = getContentResolver().openInputStream(
data.getData());
bitmap = BitmapFactory.decodeStream(stream);
stream.close();
this.UPLOAD_URL = Config.webSiteUrl + "?action=uploadFile&username=" + this.username + "&password=" + this.password + "&baustelleid=" + Fotos.this.baustelleid;
// System.out.println("xyy: " + this.UPLOAD_URL);
bitmap = scaleDown(bitmap, Config.maxImageUploadSize, true);
if(bitmap != null) {
uploadImage(bitmap, this.UPLOAD_URL);
}
} catch (IOException e1) {
// System.out.println("Fehler 2");
}
} catch (Exception e) {
// System.out.println("Fehler 1");
}
}
My problem is, that some JPEG images have got EXIF-Headers, which contain a rotation.
When i display my image, the problem is, that it is turned 180 degrees around.
How can i rotate the bitmap 180 degrees, so it is displayed the right way?
(Sorry for bad english :-) )
Edit:
The EXIF-code of the jpeg file, which is wrong around, is:
20180712_101743.jpg: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=12, height=3096, manufacturer=samsung, model=SM-A310F, orientation=lower-right, xresolution=210, yresolution=218, resolutionunit=2, software=A310FXXU3CQL2, datetime=2018:07:12 10:17:43, width=4128], baseline, precision 8, 4128x3096, frames 3
Other pictures, which are the right way:
20180712_171712.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, datetime=2018:07:12 17:17:13, model=SM-A310F, resolutionunit=2, height=0, yresolution=187, orientation=[0], software=A310FXXU3CQL2, xresolution=209, manufacturer=samsung, width=0], baseline, precision 8, 4096x2606, frames 3