項目地址
本項目是基于image庫使用純dart代碼實現(xiàn)的Luban壓縮算法,壓縮效果個人感覺還可以,目前只能算是beta版本,歡迎大家去github下載示例體驗
后續(xù)需要優(yōu)化的問題
1、只支持jpg格式
2、壓縮時間有待優(yōu)化
3、壓縮過程中頻繁的作內存讀寫(已解決)
引入
dependencies:
flutter_luban: ^0.1.1
Example
CompressObject compressObject = CompressObject(
imageFile,//image
tempDir.path,//compress to path
);
Luban.compressImage(compressObject).then((_path) {
setState(() {
print(_path);
});
});
image