title: Cleaning scanned grayscale images with ImageMagick
body: <p>I have a lots of scans of text pages (black text on white background).</p>
  
  <p>My usual approach is to clean those in Gimp using the Curves dialog using a pretty simple curve with only four points: 0,0 - 63,0 - 224,255, 255,255</p>
  
  <p>This makes all the greyish text pitch black plus makes the text sharper and turns most of the whitish pixels pure white.</p>
  
  <p>How can I achieve the same effect in a script using ImageMagick or some other Linux tool that runs completely from the command line?</p>
  
  <p><code>-normalize</code> or <code>-contrast-stretch</code> don't work because they operate with pixel counts. I need an operator which can make the colors 0-63 (grayscale) pitch black, everything above 224 pure white and the rest should be normalized.</p>