compressImage static method
Compress an image
Compresses the given fileName
.
percentage
controls by how much the image should be resized. (0-100)
quality
controls how strong the compression should be. (0-100)
Use targetWidth
and targetHeight
to resize the image for a specific
target size.
Implementation
static Future<File> compressImage(String fileName,
{int percentage = 70,
int quality = 70,
int targetWidth = 0,
int targetHeight = 0}) async {
var file = await _channel.invokeMethod("compressImage", {
'file': fileName,
'quality': quality,
'percentage': percentage,
'targetWidth': targetWidth,
'targetHeight': targetHeight
});
return new File(file);
}