Madan Mohan Madan Mohan - 1 year ago 76
Objective-C Question

How to resize the image programatically in objective-c in iphone

I have an application where I am displaying large images in a small space.
The images are quite large, but I am only displaying them in 100x100 pixel frames.
My app is responding slowly because of the size fo the images I am using.

To improve performance, how can I resize the images programmatically using Objective-C?

Answer Source

Please find the following code.

- (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size {
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext();    
    return destImage;



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download