Getting a Properly Rotated UIImage from AVCaptureSession

Recently I started work on a custom camera for You Doodle. As part of this, I was overhauling the camera picker, moving away from UIImagePickerController to my own custom camera. This required diving into AVFoundation. While I have a lot of experience with this framework, one piece took much longer than expected – rotating the final image to an ‘up’ orientation with a proper width and height value.

After several hours of hair pulling I finally conjured up this function:


May it serve you well if you are in the bowels of AVFoundation 🙂

Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Notify of