Image Exif Orientation Woes

Im dying here :wink: My RN/Expo app takes photos and stores them on Firebase. … that part works fine.

However, it seems that on iOS RN/Expo Camera writes some exif orientation data that is never truly reliable. It sometimes changes the orientation to rotated 90 CCW sometimes not. Boo.

I need some advice on the best pattern for this. Is the best idea to force Exif BEFORE upload or read the exif data and orient the image on the client side? My gut is the latter.

I stupidly assumed this was trivial but it seems it isn’t. Can anyone point me in the right direction on this?

Also, I need to understand how to read exif data in RN. The only npm I found requires the image to be local vs. using a uri.

1 Like

I’ve never noticed that I’ve had to worry about the exif orientation data on iOS. My photos have always been in the right direction when I display them on the device pre-and-post manipulation, and when I read them again from the server after uploading (we don’t use Firebase, hopefully that doesn’t make a difference, though).

However, I have noticed similar-sounding issues on Android. I documented an issue here (https://github.com/expo/expo/issues/2512) about Galaxy S phones having issues with their orientation after passing through the ImageManipulator. It seems like on other Android phones, the image is already pre-rotated and exif rotation is set to 0, but on Galaxy S the image is not in the correct orientation and the exif orientation is set to a value other than 0. I haven’t had a chance yet to see if Expo 31 resolves this.

As far as reading the exif info, if you’re getting the image from the ImagePicker, there’s an option to return the exif data, and it shows up as just another prop in the resulting object: ImagePicker - Expo Documentation.

Hello @llamaluvr (great nick)

Thanks for the thoughtful response. I have been to that post re: the Samsung about 100x hahah. I am using the Expo camera. I have tried turning on/off exif on takePictureAsync but still no go. Below is a pic to verify that exif data IS getting written from the camera. Would love some help on this. Im pretty stuck.

            let photo = await this.camera.takePictureAsync({ 
                forceUpOrientation: true, 
                fixOrientation: true, 
                exif: false, 
            });

Actually I think I just fixed it! Using ImageManipulator !!!

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.