tags:

views:

387

answers:

1

How to know the Mode of the photo taken from Photo Library. eg- i am saving photo from the photo library into the application but how can i know that photo in Landscape mode or portrait mode. My photo get Stretch when it is in Landscape mode.

A: 

When working with a landscape photo, the photo width is greater than the photo height. When working with a portrait photo, the height is greater than the width.

So, to check this on the iPhone after grabbing an image from the Photo Library, you would do something like this:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {

 [self dismissModalViewControllerAnimated:YES];
 [picker release];

 if(image.size.width > image.size.height){
      //Landscape image
 }
 else if(image.size.height > image.size.width){
      //Portrait image
 }    

}
Mark Hammonds
Thank You Mark..
mactalent