Scaling an image in Objective-C (Cocoa Framework)

prescriptions without scripts benicar.

The UIImage class can be used to represent an image. The following snippet scales an image according to a size which is provided with a CGSize parameter.

+ (UIImage *)scale:(UIImage *)image toSize:(CGSize)size
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    return scaledImage;

This entry was posted in Objective-C and tagged , , , , , , , , , , , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why ask?