#!/bin/bash INPUTDIR=o/png OUTPUTDIR=i/pdf TMPDIR=tmp LIST=pdf.list COUNT=0 # FIND FILES IN A DIRECTORY find ${INPUTDIR} -name "*.png" | sort > $LIST for PNG in `cat $LIST` do COUNT=`expr $COUNT + 1` IMAGENAME=`basename $PNG` convert $PNG \ -edge 1 -negate -normalize \ -colorspace Gray -blur 0x.5 -contrast-stretch 0x50% \ $OUTPUTDIR/`echo ${IMAGENAME%.*} | sed 's/\./___/g'`.pdf # convert $OUTPUTDIR/$COUNT.pdf -negate $OUTPUTDIR/$COUNT_neg.pdf # convert -monochrome $PNG $OUTPUTDIR/$COUNT.pdf # convert -monochrome $PNG $TMPDIR/tmp.png # autotrace -centerline $TMPDIR/tmp.png --output-file=$OUTPUTDIR/$COUNT.pdf echo $COUNT done # rm -rf tmp/* exit 0;