UIImagePNGRepresentation issues?

Posted by disorderdev on Stack Overflow See other posts from Stack Overflow or by disorderdev
Published on 2010-08-24T07:20:45Z Indexed on 2012/04/06 11:29 UTC
Read the original article Hit count: 198

I want to load images from UIImagePickerController, then save the selected photo to my app's document directory.

UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *data1 = UIImagePNGRepresentation(image);

NSString *fileName = "1.png";
NSString *path = //get Document path, then add fileName
BOOL succ = [data1 writeToFile:path atomically:YES];

but after I save the image to my document, I found that, the image was rotated 90 degree, then I change the method UIImagePNGRepresentation to UIImageJPEGRepresentation, this time it's fine, anyone know what's the problem?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch