PDA

View Full Version : Taking Photos in Landscape?




munkees
Jul 30, 2011, 02:26 AM
I want to take photos in landscape, I can capture the image using UIImagePicker, but when I apply them to my landscape image view they are stretched.

I know in the Developer documentation, it states that the camera can only take photos in Portrait, but I have noticed that the camera app (apples camera app) , allow this to be saved landscape if you turn the camera on landscape when snapping a photo.

How can I take my captured image and apply it to my UIImageView so the image is not stretched?



PhoneyDeveloper
Jul 30, 2011, 10:24 AM
Stretching or scaling is related to the aspect ratio of the image and the image view. The contentMode of the image view controls how the scaling is done. Adjusting the frame of the image view and/or the contentMode of the image view should get you what you want.

idelovski
Jul 30, 2011, 10:56 AM
Also, UIImage has imageOrientation (http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIImage_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImage/imageOrientation) property. Check that especially if you plan to save the image.

munkees
Jul 30, 2011, 01:05 PM
Thank you