+ #detect if the page is 2-up
+ for subpg in $($my_seq 1 2); do
+ echo Processing subpg ${subpg}.
+ if $(dirname $0)/detect2pages.sh $dir/upg-${pgn}-${subpg}.pnm ${pgn} ${subpg}; then
+ if [[ $verbose == 1 ]]; then
+ echo "Resplitting subpg ${subpg}."
+ fi
+ unpaper $unpaperflags --pre-rotate 90 --layout double --overwrite --no-blackfilter -op 2 $dir/upg-${pgn}-${subpg}.pnm $dir/upg-${pgn}-${subpg}-%01d.pnm
+ else
+ cp $dir/upg-${pgn}-${subpg}.pnm $dir/upg-${pgn}-${subpg}-1.pnm
+ fi;
+
+ done;
+