PREFIX=$(echo $1 | sed 's/.pdf//') TMPDIR=$(mktemp -d) MYDIR=$PWD cd $TMPDIR cp $MYDIR/$PREFIX.pdf $TMPDIR/ pdftoppm -png -x 90 -y 100 -W 1120 -H 1500 $PREFIX.pdf $PREFIX rm $PREFIX.pdf for file in * do CMD="/usr/bin/convert $file -transparent white $file" eval $CMD done cp * $MYDIR/ cd $MYDIR rm -rf $TMPDIR