Posted By

svenito on 10/06/09


Tagged

resize UIImage


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

ericschweichler
adison
bobbym245
russrenshaw


Resize UIImage


 / Published in: iPhone
 

Scales a UIImage to the given size

  1. - (UIImage *)scale:(UIImage *)image toSize:(CGSize)size
  2. {
  3. UIGraphicsBeginImageContext(size);
  4. [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
  5. UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext
  6. ();
  7. UIGraphicsEndImageContext();
  8. return scaledImage;
  9. }

Report this snippet  

You need to login to post a comment.