Skip to content

Instantly share code, notes, and snippets.

@Raudcu
Created September 1, 2020 18:00
Show Gist options
  • Save Raudcu/df96d63a6f0bec504489195be61d5d46 to your computer and use it in GitHub Desktop.
Save Raudcu/df96d63a6f0bec504489195be61d5d46 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script to convert multiple images to pdf and put them together into a single file.
# It executes in the directory where the images are: topdf IMG_1.jpg IMG_2.JPG IMG_3.jpeg OUTPUT_NAME
declare -a Files=("${@:1:$(( $#-1 ))}")
for file in ${Files[@]}
do
convert $file ${file%.*}.pdf
converted+=(${file%.*}.pdf)
done
pdftk ${converted[*]} output ${@: -1}.pdf
rm -r ${converted[*]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment