本項目是基於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);
});
});
複製代碼