Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

How to reduce the size of monochrome almost-binary image from scanners

I scanned a B4-size monochrome paper document with Epson EP-805A through Epson iPrint iOS app, and resulted a 1.9MB jpeg file (It’s too big, isn’t it?).

You can reduce the size of monochrome almost-binary image with Imagemagick convert command. I prefer options like this (I also converted to PNG):

convert -gamma 0.7 -posterize 3 -colors 16 EPSON001.jpg EPSON001.png

And you can convert all the jpeg files in current directory at once like this:

for i in *.jpg; do convert -gamma 0.7 -posterize 3 -colors 16 $i `basename $i .jpg`.png; done