Skip to content

Instantly share code, notes, and snippets.

@MarcoSero
Created October 1, 2012 11:32
Show Gist options
  • Save MarcoSero/3811090 to your computer and use it in GitHub Desktop.
Save MarcoSero/3811090 to your computer and use it in GitHub Desktop.
Objective-C Image Resizing
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize
{
//UIGraphicsBeginImageContext(newSize);
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment