RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Image is being saved in a different orientation from that of the screen #218

Closed Nkurayijahubert closed 6 years ago

Nkurayijahubert commented 6 years ago

Hello,

Am facing an issue, where image is being saved in different orientation from that of screen, if screen is in portrait mode image will be in landscape and vise-versa. Any help!

Diolor commented 6 years ago

Front or back camera? Also which device?

scifinder commented 6 years ago

A similar problem. Front (base) camera. In landscape mode, the second shot has an incorrect orientation. Steps:

  1. Turn the screen horizontally (Samsung Galaxy A3).
  2. Take a picture, display it on the preview.
  3. Go back. Make a second photo.
  4. The second picture will be shot perpendicularly (after 2.2.0 update). bug
Diolor commented 6 years ago

That's a different issue @scifinder, thanks. It's already reported in #193

Nkurayijahubert commented 6 years ago

@Diolor it's on back camera, on Nexus 5x phone.

ShkurtiA commented 6 years ago

any solutions or workarounds yet?

Nkurayijahubert commented 6 years ago

I would like to ask the same, @Diolor

Nkurayijahubert commented 6 years ago

@Diolor, Any solution?

Diolor commented 6 years ago

No, but you can send a PR @Nkurayijahubert !

dmitry-zaitsev commented 6 years ago

@Nkurayijahubert could you please share a sample photo with us?

Nkurayijahubert commented 6 years ago

device-2018-03-26-151524

@dmitry-zaitsev Here is the sample image

Nkurayijahubert commented 6 years ago

@dmitry-zaitsev as you can see phone is in portrait orientation but the image comes in landscape orientation

dmitry-zaitsev commented 6 years ago

@Nkurayijahubert please share the actual JPG image, not just the screenshot. I am trying to figure out what Exif properties the file has.

Nkurayijahubert commented 6 years ago

Ok, here it's @dmitry-zaitsev

tagshop_ishimwe_i2018_03_26_15_15_03

Nkurayijahubert commented 6 years ago

@dmitry-zaitsev before to open it's in landscape but in preview it become portrait, as you can see in that comment above.

dmitry-zaitsev commented 6 years ago

@Nkurayijahubert this is not the bug of Fotoapparat but the missing feature in your image viewer. The JPG file contains information about the image orientation and it is a responsibility of the viewer to rotate the image accordingly.

Nkurayijahubert commented 6 years ago

@dmitry-zaitsev what do you mean by image viewer? is it manufacturing issue or how the user has configured?

dmitry-zaitsev commented 6 years ago

@Nkurayijahubert by the viewer I mean the Android application you use to view the image on your device.

Nkurayijahubert commented 6 years ago

Ok, Thank you @dmitry-zaitsev let try to fix the issue

antoineFrau commented 5 years ago

Hi so I was facing this issue, and figure out that I just needed to rotate the image of 90 degrees if the width < height, meaning that the image is in landscape mode.

photoResult?.toBitmap()?.whenAvailable { photo ->
    photo?.apply {
        // Avoid the landscape image preview
       var bitmap = if (this.bitmap.width < this.bitmap.height) this.bitmap else this.bitmap.rotate(90)
        Log.i(LOGGING_TAG, "New photo captured. Bitmap length: ${this.bitmap.byteCount}")
    }
        ?: Log.e(LOGGING_TAG, "Couldn't capture photo.")
}
MayurRaval commented 4 years ago

Thanks @antoineFrau It's working fine