Thursday, August 10, 2017

Cleaning up an image for OCR with ImageMagick

convert input.png -colorspace gray -type grayscale -contrast-stretch 0 -clone 0 -colorspace gray -negate -contrast-stretch 0 -compose copy_opacity -composite -fill "white" -opaque none +matte -deskew 40% -sharpen 0x1 output.png