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

New Post: Trying to perform OrderedDither with 4 levels

$
0
0
Hello, I have the following ImageMagick commands to convert an image to grayscale and then dither it to 4 gray levels, which I'm trying to perform in Magick.NET:
convert image.png -colorspace GRAY png:out.png
convert out.png -ordered-dither h6x6a,4 png:dither.png
So here's what I have (I'm passing in an existing stream to write to):
        public void Poster1(Stream stream)
        {
            using (var image = new MagickImage(@"image.png"))
            {
                image.ColorSpace = ColorSpace.Gray;
                image.OrderedDither("h6x6a,4", Channels.Composite);
                
                image.Write(stream);
            }
        }
However, after the OrderedDither operation, my image has only black and white dithering instead of the expected 4 levels of gray. Is it possible to get an equivalent operation in Magick.NET? Thanks!

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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