如果我绘制图像,则使用CGAffinetransform

CGAffineTransform myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height);
CGContextConcatCTM(context, myTr);
[backImage drawInRect:CGRectMake(cbx, -cby, backImage.size.width, backImage.size.height)];
myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height);
CGContextConcatCTM(context, myTr);
解决了问题
当我想写文件时
我用这个
 NSData *imageData = UIImageJPEGRepresentation(backImage, 0);
然后将图像倒置
如何 ?

最佳答案

当您想要保存UIImage时,请使用:

UIGraphicsBeginImageContextWithOptions(size, isOpaque, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, (CGRect){ {0,0}, origSize }, [origImage CGImage]);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;

然后做:
 NSData *imageData = UIImageJPEGRepresentation(backImage, 0);

关于ios - iOS UIImage图像倒置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11739816/

10-09 21:56