iOS 图片压缩

来源:互联网 发布:深圳市行知实验小学 编辑:程序博客网 时间:2024/06/05 17:10
       //压缩
        NSData *imageData = UIImageJPEGRepresentation(image, 0.00001);
        
        // 获取沙盒目录
        NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"/small.png"];
        
        // 将图片写入文件
        [imageData writeToFile:fullPath atomically:NO];

0 0