Skip to content

Instantly share code, notes, and snippets.

@gotomanners
Forked from ArtSabintsev/UIImage+ResizeImage.h
Created December 15, 2013 19:32
Show Gist options
  • Save gotomanners/7977076 to your computer and use it in GitHub Desktop.
Save gotomanners/7977076 to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
@interface UIImage (ResizeImage)
+ (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size;
@end
#import "UIImage+ResizeImage.h"
@implementation UIImage (ResizeImage)
+ (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)];
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resizedImage;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment