1
我想減小UIImage
並使用下面的方法。縮小UIImage但返回更大的內存大小?
- (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return destImage;
}
它返回正確的尺寸,但具有比原始圖像更大的圖像尺寸(內存)。如何優化方法?
確保您使用相同的比例。此外,圖像將以不同的方式呈現。 – Sulthan
當你說「大於原始大小」時,你的意思是否大於'.png'文件(或其它什麼)? – Fogmeister