gpt4 book ai didi

IOS UIImage 图片颠倒

转载 作者:可可西里 更新时间:2023-11-01 03:32:31 25 4
gpt4 key购买 nike

如果我绘制我的图像,我会使用 CGAffintrasform 解决问题

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 UIImage 图片颠倒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11739816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com