When using the front camera of the iPhone 4 to take a picture, the taken picture is mirrored compared with what you see on the iPhone screen. How may I restore the \"on scre
I know this question was already answered, but the answer above didn't work for me so in case there are others...
UIImage *theImage = [info objectForKey:UIImagePickerControllerOriginalImage];
if (picker.cameraDevice == UIImagePickerControllerCameraDeviceFront) {
CGSize imageSize = theImage.size;
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 1.0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextRotateCTM(ctx, M_PI/2);
CGContextTranslateCTM(ctx, 0, -imageSize.width);
CGContextScaleCTM(ctx, imageSize.height/imageSize.width, imageSize.width/imageSize.height);
CGContextDrawImage(ctx, CGRectMake(0.0, 0.0, imageSize.width, imageSize.height), theImage.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
and newImage is your new image with the up orientation