public void ApplyRandomization()
      {
        var fileInfo = new FileInfo(_sourceImagePath);
        var targetDirectory = fileInfo.Directory.CreateSubdirectory(BinaryRandomizer.FolderName + "_" + Path.GetFileNameWithoutExtension(fileInfo.Name));

        foreach (var randomizationPercent in RandomizationPercents)
        {
          using (var image = new Bitmap(_sourceImagePath))
          {
            using (var transformer = new BinaryTransformer(randomizationPercent))
            {
              transformer.ApplyRandomization(image);
            }
            var path = Path.Combine(targetDirectory.FullName, Path.GetFileNameWithoutExtension(fileInfo.Name) + "_" + randomizationPercent + fileInfo.Extension);
            image.Save(path);
          }
        }
      }
Exemple #2
0
        public void ApplyRandomization()
        {
            var fileInfo        = new FileInfo(_sourceImagePath);
            var targetDirectory = fileInfo.Directory.CreateSubdirectory(FolderName + "_" + Path.GetFileNameWithoutExtension(fileInfo.Name));

            foreach (var randomizationPercent in RandomizationPercents)
            {
                using (var image = new Bitmap(_sourceImagePath))
                {
                    using (var transformer = new BinaryTransformer(randomizationPercent))
                    {
                        transformer.ApplyRandomization(image);
                    }
                    var path = Path.Combine(targetDirectory.FullName, Path.GetFileNameWithoutExtension(fileInfo.Name) + "_" + randomizationPercent + fileInfo.Extension);
                    image.Save(path);
                }
            }
        }