-(UIImage*)processImageRect:(UIImage*)image:(CGSize)size:(CGSize)originalSize {
// Draw image1
UIGraphicsBeginImageContext(originalSize);
[image drawInRect:CGRectMake(0.0, 0.0, size.width, size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
return resultingImage;
}
//This function will be helpful to you.