ios - 旋转和裁剪 UIImage

标签 ios objective-c uiimage cgimage

假设我有一个 UIImage。 我需要旋转然后在全局坐标系(不是 UIImage 坐标系)中裁剪它。因此生成的图像将被裁剪旋转。

我该怎么做? CGImageCreateWithImageInRect 将仅在图像相对坐标中裁剪图像。

enter image description here

PS 在评论中回答。你应该使用 CIImage。

最佳答案

也许这可以帮助

//init
CIImage *image = [CIImage imageWithCGImage:CGImageRef];
//rotation
CIImage *rotatedImage = [image imageByApplyingTransform:someTransform];
//crop
CIImage *croppedImage = [rotatedImage imageByCroppingToRect:someRect];

关于ios - 旋转和裁剪 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25822730/

相关文章:

ios - 试图恢复消耗性 IAP 的沙箱

objective-c - 将 Action 限制在每天一次

ios - DynamoDB 自增 ID 和服务器时间(iOS SDK)

iphone - 如何将我的主页的纬度/经度与 iPhone 中主页图像的像素关联起来?

ios - 在UIImageView中将UIButton的图像水平对齐

ios - MailChimp中的电子邮件,名称和自定义属性(快速3)

ios - 如何显示从数据库中获取的值?

objective-c - 异常解析 NSDictionary 内的 NSDictionary

iphone - 从 iPhone 中的一系列颜色创建图像

ios - 应用程序更新后核心数据存储为空 - 但数据模型未更改