我有缩放UIImage的方法
- (UIImage*)croppedImageWithImage:(UIImage *)image zoom:(CGFloat)zoom
{
CGFloat zoomReciprocal = 1.0f / zoom;
CGPoint offset = CGPointMake(40, 40);
CGRect croppedRect = CGRectMake(offset.x, offset.y, image.size.width * zoomReciprocal, image.size.height * zoomReciprocal);
CGImageRef croppedImageRef = CGImageCreateWithImageInRect([image CGImage], croppedRect);
UIImage* croppedImage = [[UIImage alloc] initWithCGImage:croppedImageRef scale:[image scale] orientation:[image imageOrientation]];
CGImageRelease(croppedImageRef);
return croppedImage;
}
如何在变焦后保存图像宽度和高度?
答案 0 :(得分:1)
保存缩放图像:
UIImageWriteToSavedPhotosAlbum(croppedImage, nil, nil, nil);
保存图像尺寸
CGSize imageSize = CGSizeMake(croppedImage.size.width, croppedImage.size.height);
答案 1 :(得分:0)
如果要保存图像宽度和高度,只需创建CGSize变量并保存如下
CGSize croppedSize = croppedImage.size