在旋转图像后使用UIImageWriteToSavedPhotosAlbum保存图像

时间:2012-04-10 09:43:08

标签: iphone

UIImageWriteToSavedPhotosAlbum()工作得很好,直到我旋转图像。根据条件,我想在保存之前旋转图像。但是当我这样做时,只有当它在旋转之后才会出现低分辨率。

UIGraphicsBeginImageContextWithOptions(selectedPhoto.bounds.size, self.view.opaque, 2.0);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    myImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    if (rotate == true) {


        myImage = [myImage imageRotatedByDegrees:-90];
        UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil);
    }else {

        UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil);
    }

请提示吗?

1 个答案:

答案 0 :(得分:2)

你走了。在方向上设置特定方向。使用时不要忘记释放rotateImage。

UIImage *rotatedImage = [[UIImage alloc] initWithCGImage: originalImage.CGImage
                                                       scale: 1.0
                                                 orientation: UIImageOrientationLeft];
相关问题