I am taking an image from the camera, and rotating it to a new orientation, and then pasting it onto the general pasteboard. However, no matter what I pass in to orientation, what ends up being pasted later by the pasteboard paste command is oriented as if it were UIImageOrientationUp.
CGImageRef croppedImageRef = CGImageCreateWithImageInRect([self CGImage], CGRectMake(rect.origin.y, [self size].width - rect.origin.x - rect.size.width, rect.size.height, rect.size.width));
UIImage *croppedImage = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:orientation];
CGImageRelease(croppedImageRef);
[[UIPasteboard generalPasteboard] setImage:croppedImage];
I use similar code to successfully rotate images from the camera and insert them into the photo album:
CGImageRef croppedImageRef = CGImageCreateWithImageInRect([self CGImage], CGRectMake(rect.origin.y, [self size].width - rect.origin.x - rect.size.width, rect.size.height, rect.size.width));
UIImage *croppedImage = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:orientation];
CGImageRelease(croppedImageRef);
[self writeUIImageToCameraRoll:croppedImage withOrientation:orientation];
How come I can't get the image rotated as I wish for the pasteboard? Is the paste action using an EXIF orientation? If so, is imageWithCGImage copying the original EXIF to the new image?