0

I'm coding an app where users can upload pictures and add some filters to it. The problem is that when I apply filter on it, the picture is rotating, ONLY if the picture has been taken with back camera.

If it was a selfie the picture is not rotating If the picture is in portrait mode, the picture is not rotating

The problem is that I don't know how I could get these information, in order to rotate the picture only when I need it.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
KevinB
  • 2,454
  • 3
  • 25
  • 49
  • The orientation is probably in the metadata of the image, look here on how to get the metadata https://stackoverflow.com/questions/12478502/how-to-get-image-metadata-in-ios – Jacob Lange Apr 09 '18 at 19:44

1 Answers1

3

You're thinking about this the wrong way. It may be the case that images taken with your phone's rear camera appear rotated after applying a filter, but you cannot make this assumption for all devices. Instead, you can read the imageOrientation property on UIImage to obtain information about whether the image has an unusual rotation.

dalton_c
  • 6,876
  • 1
  • 33
  • 42