Page 1 of 1

reduce scanned image to black/red/white

Posted: 2007-09-02T11:09:13-07:00
by jop
I'd like to color reduce TIF images which contain scans of black text on white paper, with red proof read annotations. I thought that a custom color map with three colors #000000, #ffffff, and #ff0000 would be best, with pixels mapped to their nearest neighbor.

I tried

Code: Select all

mogrify +dither -posterize 2 -map colormap.gif -format png *.tif
where colormap.gif is a GIF file with the above three color map.

However I feel that there might be easier solutions. How can I specify this easy color map directly on the command line without the need of a dummy colormap.gif file?

Option 'posterize 2' alone yields green and blue and yellow artefacts at the border of black characters.

Re: reduce scanned image to black/red/white

Posted: 2007-09-05T19:50:47-07:00
by anthony
-posterize is itself a -map type operator, it is equivelent to -threshold 50% you don't want it.

You also don't want dithering, but direct color substituion so need to add +dither

Finally mogrify is dangerious. be very careful with it.

Code: Select all

mogrify image   +dither  -map colormap.gif  -format png *.tif

Re: reduce scanned image to black/red/white

Posted: 2007-09-07T14:49:59-07:00
by jop
anthony wrote:-posterize is itself a -map type operator, it is equivelent to -threshold 50% you don't want it.
Thanks - works like a charm.