identify static method

Future<ImageProperties> identify(
  1. File file
)

Implementation

static Future<ImageProperties> identify(File file) async {
  Process p = await Process.start("magick", ["identify", file.path]);
  // get the output of the command
  Stream<String> s =
      p.stdout.transform(utf8.decoder).transform(LineSplitter());
  p.stderr.pipe(stderr);
  int exitCode = await p.exitCode;
  ImageProperties props =
      ImageProperties.fromMagickOutput((await s.toList()).first);
  print("Magick exit code: $exitCode");

  if (exitCode != 0) {
    throw Exception("ImageMagick command failed with exit code $exitCode");
  }

  return props;
}