Skip to content

Commit

Permalink
chore: update cover converter script
Browse files Browse the repository at this point in the history
  • Loading branch information
fky2015 committed Sep 4, 2022
1 parent 20444a3 commit a3f4f45
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/convert-cover.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# This script convert all PDF covers to PNG format.
#!/bin/bash

# cd to the directory where the script is located
cd "$(dirname "$0")" || exit

ls ../*/main.pdf | sed -r 's|/[^/]+$||' | sed -r 's|^../||' | sort | uniq | xargs -I {} convert -density 300 "../{}/main.pdf[0]" -quality 100 "{}.png"
mkdir -p templates

# This script convert all PDF covers to PNG format.
find ../templates/ -type f -name 'main.pdf' | sed -r 's|/[^/]+$||' | sed -r 's|^../||' | sort | uniq | xargs -I {} convert -density 300 "../{}/main.pdf[0]" -quality 100 "{}.png"

# Special case for `master-thesis` as second page is more interesting.
convert -density 300 "../master-thesis/main.pdf[1]" -quality 100 "master-thesis.png"
convert -density 300 "../templates/graduate-thesis/main.pdf[2]" -quality 100 "templates/graduate-thesis.png"

0 comments on commit a3f4f45

Please sign in to comment.