iOS 图片压缩

+ (UIImage *)scaleFromImage:(UIImage *)image {
    CGSize newSize = CGSizeMake(366, 366);   //目标图片的大小
    UIGraphicsBeginImageContext(newSize);
    [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
   
    NSData *data1 = UIImagePNGRepresentation(newImage);
        CGFloat dataSize1 = data1.length/1024;
        NSLog(@"###########%.2f",dataSize1);
    return newImage;
}
上一篇:iOS图片压缩问题


下一篇:Mysql中explain命令查看语句执行概况