如下的资料是关于ios对图像进行压缩的内容。
{
CGSize imageSize = image.size;
CGFloat width = imageSize.width;
CGFloat height = imageSize.height;
if (width <= newSize.width && height <= newSize.height){
return image;
}
if (width == 0 || height == 0){
return image;
}
CGFloat widthFactor = newSize.width / width; CGSize targetSize = CGSizeMake(scaledWidth,scaledHeight); } 欢迎分享,转载请注明来源:内存溢出
CGFloat heightFactor = newSize.height / height;
CGFloat scaleFactor = (widthFactorUIGraphicsBeginImageContext(targetSize);
[image drawInRect:CGRectMake(0,0,scaledWidth,scaledHeight)];
UIGraphicsEndImageContext();
return newImage;
评论列表(0条)