An image compress package like Luban for Dart, based on image.This library has no system platform constraints.
If toRgb: true , it supports all readable image formats
CompressObject compressObject = CompressObject(
imageXFile: imageXFile, //image file
path: tempDir.path, //compress to path, default Directory.systemTemp.path
useCache: true, //If there is a cache, no compression will be performed
toRgb: true, //Convert the image to jpg
numberOfColors: 128, //the numberOfColors of image.quantize
);
Luban.compressImage(compressObject).then((xfile) {
setState(() {
print(xfile.path);
});
});