make method

Future<void> make(
  1. String iconPath,
  2. String outputPath,
  3. List<ImageSet> imageSetList, {
  4. ImageProcessingMethod method = ImageProcessingMethod.imgLib,
})

Implementation

Future<void> make(
  String iconPath,
  String outputPath,
  List<ImageSet> imageSetList, {
  ImageProcessingMethod method: ImageProcessingMethod.imgLib,
}) async {
  ImageProcessorAdapter imageProcessorAdapter;
  if (method == ImageProcessingMethod.magick) {
    imageProcessorAdapter = ImageProcessorAdapterMagick();
  } else {
    imageProcessorAdapter = ImageProcessorAdapterImglib();
  }

  for (ImageSet imageSet in imageSetList) {
    for (Image image in imageSet.images) {
      String imagePath = [
        outputPath,
        imageSet.path,
        image.path,
        image.filename,
      ].join('');

      ImageProcessor(imageProcessorAdapter)
          .load(iconPath)
          .resize(image.width.toInt(), image.height.toInt())
          .save(imagePath);

      print('Success: $imagePath');
    }
  }
}