Skip to content

Instantly share code, notes, and snippets.

@ZappaBoy
Created June 14, 2022 22:48
Show Gist options
  • Save ZappaBoy/eb3da2710a3afb30a4c13c8e39284d2f to your computer and use it in GitHub Desktop.
Save ZappaBoy/eb3da2710a3afb30a4c13c8e39284d2f to your computer and use it in GitHub Desktop.
PDF to gif - pdf2gif
# This script convert pdf to a gif
# First parameter is the .pdf file and the second (optional) parameter is the delay between the images
# Hint:
# instead of copy the script simply add the pdf-to-gif function to your ~/.bash_aliases
# and add the line: alias pdf2gif="pdf-to-gif"
# Example:
#
# function pdf-to-gif(){
# mkdir -p /tmp/pdf2gif/
# convert "$1" /tmp/pdf2gif/page-%04d.jpg
# convert -delay ${2:-120} -loop 0 /tmp/pdf2gif/*.jpg animation.gif
# rm -f /tmp/pdf2gif/*.jpg
# rmdir /tmp/pdf2gif/
# }
# alias pdf2gif="pdf-to-gif"
function pdf-to-gif(){
mkdir -p /tmp/pdf2gif/
convert "$1" /tmp/pdf2gif/page-%04d.jpg
convert -delay ${2:-120} -loop 0 /tmp/pdf2gif/*.jpg animation.gif
rm -f /tmp/pdf2gif/*.jpg
rmdir /tmp/pdf2gif/
}
pdf-to-gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment