Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Fred's ImageMagick Scripts

$
0
0
I have not heard of anyone who translated Fred his script to C#. If I would do this myself I would create a class for each script. But I don't think if you are allowed to do this without his permission due to the license he uses.

His script 2colorthresh would translate to something like this:
publicstaticclass TwoColorThresh
{
  MagickImage static Execute(MagickImage input)
  {
    // This script does the following:// convert $input +dither -colors 2 -colorspace gray -contrast-stretch 0 $output

    MagickImage output = input.Clone();
    output.Quantize(new QuantizeSettings()
    {
      Colors = 2, // -colors 2
      DitherMethod = DitherMethod.No, // +dither,
      ColorSpace = ColorSpace.GRAY // -colorspace gray
    });
    // The overload below won't work until the next release.
    output.ContrastStretch(0); // -contrast-stretch 0return output;
  }
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>