如何在Flutter / Dart中读取(从磁盘)和调整图像大小

import dart:io as Io;
import package:image/image.dart;
void main() {
  // Read a jpeg image from file.
  Image image = decodeImage(new Io.File(test.jpg).readAsBytesSync());
 
  // Resize the image to a 120x? thumbnail (maintaining the aspect ratio).
  Image thumbnail = copyResize(image,120);
 
  // Save the thumbnail as a PNG.
  new Io.File(out/thumbnail-test.png)
        ..writeAsBytesSync(encodePng(thumbnail));
}

 

如何在Flutter / Dart中读取(从磁盘)和调整图像大小

上一篇:两台电脑同时ssh连接另一台,如何实现同步操作?


下一篇:find应用