This project has moved and is read-only. For the latest updates, please go here.

Reduce pictures to very low number of colors

Sep 10, 2015 at 11:00 PM
I would like to use with VB.Net to convert high res color pictures to a controlled number of colors (between 4 and 9) maybe using a personalized Ordered dither map.
Anybody can help ?
Many thanks
Sep 11, 2015 at 7:48 PM
You can reduce the number of colors with the Quantize method. You can specify your own ordered dither map with the OrderedDither method. But then you will need to use your own .xml files and modify the thresholds.xml file. You can find some information about the file format for the threshold.xml file here: The xml files can be found here: and the documentation page has an example on how you can initialize the Magick.NET environment with your own xml files.
Sep 11, 2015 at 11:25 PM
Many thanks for the info, it is still not clear to me how to control the number of colors with ordered dither maps.
I always endup in 8 colors using "hlines12x4" for example.
If I use .Quantize I can set .colors but I don't like the floydSteinberg resulting picture.
What if I need 6 or 5 maximum but I want to use dither maps ?

How can I get using VB.Net and Magick.Net the list of colors used by a picture and the count of pixels for each one ?

Many thanks in advance
Sep 12, 2015 at 8:13 AM
Edited Sep 12, 2015 at 8:14 AM
I am also not an expert on ordered dither maps. Maybe you could ask your question on the ImageMagick forum ( and then I can help you translate the command line back to C#.

You can use the Histogram method of the MagickImage class to get a count per color in the image.