压缩图片

#pragma mark -压缩图片

-(UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize

{

    UIGraphicsBeginImageContext(newSize);

    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return newImage;

}

你可能感兴趣的:(D)