This project has moved. For the latest updates, please go here.

Binarizing an image with

Feb 1 at 8:53 PM
Edited Feb 2 at 4:10 PM
I'm having trouble figuring out how to binarize an image for OCR with
Im currently converting the image to greyscale and then normalizing but im not sure how to convert the colors to black and white in between
MagickImage x = new MagickImage(originalImage);
x.ColorSpace = ImageMagick.ColorSpace.Gray;
// This is where im missing a step

The options in image magick that im trying to replicate are
-colorspace gray +dither -colors 2 -normalize
Feb 3 at 7:39 AM
Edited Feb 3 at 7:46 AM
The -colors option has a completely different name in the MagickImage class. It will call the quantize method. Your command translates to this:
image.Quantize(new QuantizeSettings()
  ColorSpace = ColorSpace.Gray, // -colorspace gray
  DitherMethod = DitherMethod.No, // +dither
  Colors = 2 // -colors 2
image.Normalize(); // -normalize