本项目是基于image库使用纯dart代码实现的Luban压缩算法,压缩效果我的感受还能够,目前只能算是beta版本,欢迎你们去github下载示例体验git
一、只支持jpg格式github
二、压缩时间有待优化算法
三、压缩过程当中频繁的做内存读写(已解决)优化
dependencies:
flutter_luban: ^0.1.1
复制代码
CompressObject compressObject = CompressObject(
imageFile,//image
tempDir.path,//compress to path
);
Luban.compressImage(compressObject).then((_path) {
setState(() {
print(_path);
});
});
复制代码