IOS UIImage图像颠倒了 [英] IOS UIImage Image upside down

查看:207
本文介绍了IOS UIImage图像颠倒了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我绘制我的图像我修复了问题使用CGAffintrasform

if i draw my image I fixed the problem use 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);

当我想写入文件
i使用此

when i wanna write to file i use this

 NSData *imageData = UIImageJPEGRepresentation(backImage, 0);  

然后图像颠倒
如何?

then Image upside down how ?

推荐答案

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

When you want to get a UIImage to save, use:

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图像颠倒了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆