- (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size { UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); [img drawInRect:CGRectMake(0, 0, size.width, size.height)]; UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return scaledImage; }