# convert from pdf
origfile=$dir/pg-${pgn}.png
- if [ ! -e $origpnm ] || [[ $forcepdf ]]; then
+ if [ ! -e $origfile ] || [[ $forcepdf ]]; then
convert $convertflags -depth $depth -density $dpi $file[$(expr $pg - 1)] \
$origfile || exit 1
fi;
cropcords=$(convert -border 1x1 -bordercolor '#000' -resize 1000% -trim -fuzz 90% -format "%wx%h%O" $dir/pg-mask-${pgn}.png info: || exit 1)
# ... crop and despeckle? the final pre-prepared image
- convert $convertflags -crop $cropcords $origpnm $preppnm || exit 1
+ convert $convertflags -crop $cropcords $origfile $preppnm || exit 1
elif [[ $skipmask ]]; then
- cp $origpnm $preppnm
+ cp $origfile $preppnm
fi;
# check it hasn't mostly disappeared - e.g. if the scan was all black