我正在使用以下代码来裁剪并创建一个更大的UIImage.我已经将问题与CGImageCreateWithImageInRect()函数隔离开来,它似乎没有按照我想要的方式设置一些CGImage属性.:-)问题是调用函数UIImagePNGRepresentation()失败返回nil.
CGImageRef origRef = [stillView.image CGImage];
CGImageRef cgCrop = CGImageCreateWithImageInRect( origRef, theRect);
UIImage *imgCrop = [UIImage imageWithCGImage:cgCrop];
Run Code Online (Sandbox Code Playgroud)
...
NSData *data = UIImagePNGRepresentation ( imgCrop);
Run Code Online (Sandbox Code Playgroud)
- libpng错误:没有IDAT写入文件
知道UIImage中裁剪矩形可能有什么不妥或替代吗?非常感谢!