//压缩图片,传入需要的宽高   (拿到图片,调压缩图片的方法,传入需要的宽高)
[self imageWithImage:image scaledToSize:CGSizeMake(200, 200)];


//压缩图片
- (UIImage *)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize
{
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}