ImageMagick convert scan
From WickyWiki
After scanning a document you may want to resize and compress the resulting image. You should scan with a higher resolution so you can have a better-quality lower resolution. The white paper background will probably not end up being white so we add a 'white-threshold'. A lower value will mean more light areas are converted to pure white.
convert '*.jpg' -set filename:f '%t(resized).%e' -white-threshold 92% -resize 1500x -quality 80 '%[filename:f]'
Also see: