How to use ImageManipulator to crop rotated images?

Hej everyone,

in my current project I want to enable the user to crop images on the device, before uploading. However, I just figured out that Expo.ImageManipulator is agnostic to a rotation setting in the image’s exif metadata = exif.Orientation. That is to say, cropping images with the same dimensions but different exif.Orientation values, produce different results when cropping with the same rectangle set. Or in other words, the crop rectangle you want to use has to accompany for different images’ exif.Orientation settings. If any of this is unclear, I put together a Snack that displays this:
Snack

Also a repo if someone wants to check on iOS devices.
Repo

I have to say that for my specific project I am only interested on iOS. On Android you will encounter different problems depending on whether your device reorients images with exif.Orientation or not.

Now, from checking a multitude of sources I understand that it is possible to workaround this by rotating and/or mirroring the image before I use the crop method. That works fine when I access the image to crop from Expo.Camera or Expo.ImagePicker, because you can get the exif data alongside the image with the options param and then compensate for the exif.Orientation stored.

However, and this is my main problem, how do I handle this for images I got by using RN’s own CameraRoll.getPhotos() or Expo.Asset because for these images I have no access to the exif.Orientation data?

As always, any help is hugely appreciated.

Cheers,
Johannes

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