commit f47db6205853f86a552bc9d5f800f3ebf62da16c parent 05df330e8487fe6be36292b52f650e3d7103e0c9 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Thu, 5 Sep 2019 23:45:28 +0200 candidate master script Diffstat:
master.sh | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/master.sh b/master.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# reflow sheet music to new dimensions + +FILE="$1" +WIDTH="$2" +HEIGHT="$3" +OUTFILE="$4" +MARGIN="${5-20}" +DENSITY="${6-250}" +FIXCMD="${7-echo 'not fixing anything'}" + +mkdir -p tmp pages lines chunks outpages + +#TMPDIR=./tmp convert -background white -alpha remove -alpha off \ -quality 100 -density "$DENSITY" "$FILE" pages/page_%04d.png + +# ls pages/* | parallel ./splith.py --maxheight=$(($HEIGHT-2*$MARGIN)) '{}' ./lines/ +# ls lines/* | parallel ./splitw.py '{}' ./chunks/ $(($WIDTH-2*$MARGIN)) + +$FIXCMD "$(($WIDTH-2*$MARGIN))" + +./combine.py --hmargin="$MARGIN" --vmargin="$MARGIN" chunks/ outpages/ "$HEIGHT" +ls outpages/*.png | while read a ; do echo $a; convert -interpolate bilinear $a ${a%.png}.pdf; done +pdftk outpages/*.pdf cat output "$OUTFILE" +