Last active
December 16, 2020 19:38
-
-
Save macbre/3c40dacfd4e23fb03c7695a5af75a070 to your computer and use it in GitHub Desktop.
calendar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export TMPDIR="${HOME}/.tmp" | |
mkdir -p $TMPDIR | |
FILES=$(ls *.svg | egrep '[0-9]\.') | |
DPI=400 | |
# inkscape --file=12.svg --export-text-to-path --export-dpi=300 --export-pdf-version=1.5 --export-filename=pdf/12.pdf | |
for file in $FILES | |
do | |
dest=${file/.svg/.pdf} | |
echo "Converting $file to $dest ..." | |
inkscape --file=$file --export-text-to-path --export-dpi=${DPI} --export-pdf-version=1.5 --export-filename=pdf/$dest 2>/dev/null | |
done | |
# merge pages into a single file | |
FILES=$(ls pdf/*.pdf | tr "\n" ' ') | |
# https://askubuntu.com/questions/1041349/imagemagick-command-line-convert-limit-values | |
echo "Merging pages into a single file - ${FILES}..." | |
# convert -list resource | |
# cat /etc/ImageMagic-6/policy.xml | |
# https://github.com/ImageMagick/ImageMagick/issues/396 | |
time convert -verbose -monitor \ | |
-density ${DPI} \ | |
-compress jpeg \ | |
-quality 90 \ | |
${FILES} \ | |
calendar_2021.pdf | |
pdfinfo calendar_2021.pdf | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment