ngf-fix-orientation creates invalid image file due to misinterpretation of exif metadata

Author: sandronmCreated Jun 11, 2016Updated Dec 3, 2022
Labelsbug

Hello!

I want to display a thumbnail of my uploaded image. For portrait image, I must use ngf-fix-orientation="true" to display correctly the thumbnail. Problem: sometime the generated image is invalid (black background...) This never occurs when I upload a landscape image so yes, the problem comes from ngf-fix-orientation.

I tried with Firefox (latest version), Chrome (latest version) on my app but also in your demo (https://angular-file-upload.appspot.com/)

After investigation, this comes from a misinterpretation of exif metadata. I always have the problem when I upload this image: Image 1 But never with this image: Image 2

If it could help, when I open image 1 with GIMP, the program asks me if I want to rotate the image according the exif metadata as you can see (sorry it's in french): GIMP dialog

GIMP doesn't ask me anything when I open Image 2.

But as you can see, the EXIF metadata are setted in Image 1 because GIMP asks me if I want to use them to rotate my photo. But ngf-fix-orientation cannot do that.

Thank you for your help!

Source: danialfarid/ng-file-upload