Last active
June 29, 2023 03:57
-
-
Save ITJesse/42568df628bd3498b05c48b2be5af6aa to your computer and use it in GitHub Desktop.
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 | |
for FILE in "$@" | |
do | |
echo $FILE | |
NAME=$(basename "$FILE" | cut -d . -f1) | |
PAGES=`pdfinfo "$FILE" | grep Pages | grep -P '\d+' -o` | |
mkdir -p "$NAME" | |
seq 1 $PAGES | parallel pdftoppm -f {} -l {} -aa yes -r 400 -png "$(printf "%q" "$FILE")" "$(printf "%q/img" "$NAME")" | |
find $NAME -type f -name "*.png" | parallel optipng -o4 {} | |
done |
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 | |
for FILE in "$@" | |
do | |
echo $FILE | |
NAME=$(basename "$FILE" | cut -d . -f1) | |
PAGES=`pdfinfo "$FILE" | grep Pages | grep -E '\d+' -o` | |
mkdir -p "$NAME" | |
seq 1 $PAGES | parallel pdftoppm -f {} -l {} -aa yes -r 300 -jpeg -jpegopt quality=90,optimize=y "$(printf "%q" "$FILE")" "$(printf "%q/img" "$NAME")" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment