Skip to content

Instantly share code, notes, and snippets.

@tankxu
Last active January 15, 2020 16:26
Show Gist options
  • Save tankxu/fd16311372980f125b709a582f5e5a23 to your computer and use it in GitHub Desktop.
Save tankxu/fd16311372980f125b709a582f5e5a23 to your computer and use it in GitHub Desktop.
Convert multi page pdf to a single jpg file
#! /bin/bash
# set -e
for file in ./pdf/*
do
fileName=$(basename -- "$file")
fileName="${fileName%.*}"
# echo $filename
pdfName=./pdf/$fileName.pdf
outputName=./jpg/$fileName.jpg
convert -density 150 $pdfName ./output.jpg && convert -append output-*.jpg $outputName && rm output-*.jpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment