]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/blob - .zsh_functions/henkspngpostproc
c35650d634672f274590f21c3d10e54955bd5e85
[user/henk/vcsh/zsh.git] / .zsh_functions / henkspngpostproc
1 local resize_by
2 local img
3 resize_by="$1"
4 shift
5 echo "Creating Directories …"
6 mkdir --parents resized/pngnqed/optipnged optimized
7 for img in $*
8 do
9         echo "Resizing image …"
10         convert -resize $resize_by% "$img" "resized/$img"
11         echo "Running pngnq …"
12         pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img"
13         echo "Running optipng …"
14         optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img"
15         echo "Moving final image to directory 'optimized' …"
16         cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img"
17         echo "Removing temporary images …"
18         #rm --verbose --interactive \
19         rm --verbose \
20                 "resized/$img" \
21                 "resized/pngnqed/$img" \
22                 "resized/pngnqed/optipnged/$img"
23         img2pdf --output $(basename $img .png).pdf optimized/${img}
24 done
25 rmdir --parents resized/pngnqed/optipnged