Skip to content

Instantly share code, notes, and snippets.

@facholi
Created September 16, 2016 20:31
Show Gist options
  • Save facholi/87b31d7aaacb39efaf8ad6138c6a801d to your computer and use it in GitHub Desktop.
Save facholi/87b31d7aaacb39efaf8ad6138c6a801d to your computer and use it in GitHub Desktop.
With a list of object names as argument, this script download each pdf file from AWS S3 and converts the pages to JPG images
#!/bin/sh
bucket="multiplat-resources-homolog/";
prefix="content/";
while read -r line || [[ -n $line ]]; do
echo "downloading file $line";
pdfname=$(echo "$line" | sed 's/-original//');
aws s3 cp s3://$bucket$prefix$line $pdfname.pdf;
mkdir $pdfname;
echo "generating the pages...";
time gm convert -density 200 -quality 100 -geometry 1300x1300 $pdfname.pdf +adjoin jpg:$pdfname/page%06d
echo "done $pdfname.";
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment