Friday, August 14, 2015

Clean and compress images of scanned pages

In bash:

 for a in *JPG; 
 do gm convert $a -rotate -90 -colorspace gray PPM:- | gm convert - -threshold $v CBR/${a%.JPG}.png;
 echo $a; 
 done

gm stands for graphicmagick, which is a *faster* clone of Imagemagick $v is a calibration value between 0 and 255 (in Imagemagick it spans between 0 and 65535 ).

No comments: