Neo
Neo

Reputation: 897

iPhone save the rotated UIImage

I want to save the rotated image to the photo library. I have a UIImageView in which the image is displayed. I used the below snippet to flip the image. The rotated image does get displayed since I transform the image view. But while saving the image I get the original image (not flipped). How do I save a flipped image?

#define DEGREES_TO_RADIANS(__ANGLE__) ((__ANGLE__) / 180.0 * M_PI)
    CGAffineTransform cgCTM = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(180));
    imageView.transform = cgCTM;

Upvotes: 0

Views: 752

Answers (1)

Dan Lorenc
Dan Lorenc

Reputation: 5394

Check out the

UIGraphicsGetImageFromCurrentImageContext

method.

Upvotes: 1

Related Questions