load method

  1. @override
Future<ImagePipelineAsset> load(
  1. File file
)
override

Implementation

@override
Future<ImagePipelineAsset> load(File file) async {
  File png =
      File("${file.path}compatpng${Random().nextInt(100000) + 100000}");
  List<dynamic> r = await Future.wait([
    (img.Command()
          ..decodeImageFile(file.path)
          ..encodePng(level: 6)
          ..writeToFile(png.path))
        .executeThread()
        .then((_) async {
      MagickWand wand = MagickWand.newMagickWand();
      await wand.magickReadImage(png.path);
      await png.delete();
      return wand;
    }),
    MagickCLI.identify(file)
  ]);
  ImageProperties properties = r[1] as ImageProperties;

  return ImagePipelineAsset(
      src: file,
      format: properties.format,
      properties: properties,
      wand: r[0]);
}