有没有办法获得UIImage的镜像(水平/垂直)而不会降低图像的质量?

时间:2018-05-10 06:53:03

标签: ios objective-c uiimage

我用过

[UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationDownMirrored]

[UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationUpMirrored];

获得倒置图像,但质量似乎降低了。有没有办法获得倒置图像而没有任何退化?

我尝试使用

-(UIImage*)getHoriMirror:(UIImage*)img
{
    CIImage* cii = [CIImage imageWithCGImage:img.CGImage];
    cii = [cii imageByApplyingTransform:CGAffineTransformMakeScale(1, -1)];
    CIContext *Context = [CIContext contextWithOptions:nil];
    CGImageRef cgImage = [Context createCGImage:cii fromRect:[cii extent]];
    UIImage* uiImage = [UIImage imageWithCGImage:cgImage];
    CGImageRelease(cgImage);
    return uiImage;
}

获得倒置图像,但它也降低了输出。 有什么帮助吗?

0 个答案:

没有答案