在Flutter中,我如何执行以下3个步骤:
我已经用this进行过尝试,但是它仍然给了我很大的文件。
IM.Image fileImage = IM.decodeImage(file.readAsBytesSync());
var newWidth = (fileImage.width / 100 * 10).toInt();
var newHeight = (fileImage.height / 100 * 10).toInt();
IM.Image resizeImage = IM.copyResize(fileImage, height: newHeight, width: newWidth);
IM.Image modImage = IM.adjustColor(resizeImage,
brightness: 50, contrast: 50, saturation: 0.0, amount: 1);
final tempDir = await getTemporaryDirectory();
File compressedImage = new File('${tempDir.path}/${path.basename(file.path)}')..writeAsBytesSync(IM.encodePng(modImage, level:9));