script to PDF to JPG using pdftk and imagemagick
#!/bin/bash | |
# Script to convert PDF file to JPG images | |
# | |
# Dependencies: | |
# * pdftk | |
# * imagemagick | |
PDF=$1 | |
echo "Processing $PDF" | |
DIR=`basename "$1" .pdf` | |
mkdir "$DIR" | |
echo ' Splitting PDF file to pages...' | |
pdftk "$PDF" burst output "$DIR"/%04d.pdf | |
pdftk "$PDF" dump_data output "$DIR"/metadata.txt | |
echo ' Converting pages to JPEG files...' | |
for i in "$DIR"/*.pdf; do | |
convert -colorspace RGB -interlace none -density 300x300 -quality 100 "$i" "$DIR"/`basename "$i" .pdf`.jpg | |
done | |
echo 'All done' |
This comment has been minimized.
This comment has been minimized.
How this it works can you help me? :( |
This comment has been minimized.
This comment has been minimized.
Thanks a lot for your work! I've ported this script to Windows, here you can find my gist https://gist.github.com/agurz/7c72653bf1923804f26b8c0211de4669 |
This comment has been minimized.
This comment has been minimized.
Hin: you need to have ghostscript installed for this as imagemagick relies on it. If it's missing you might see an error like
|
This comment has been minimized.
This comment has been minimized.
thanks man, really usefull! |
This comment has been minimized.
This comment has been minimized.
Thanks for clearing that up! |
This comment has been minimized.
This comment has been minimized.
Very Nice. Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks a lot for this!