Skip to content

Instantly share code, notes, and snippets.

@imrehg
Created January 11, 2013 09:28
Show Gist options
  • Save imrehg/4509268 to your computer and use it in GitHub Desktop.
Save imrehg/4509268 to your computer and use it in GitHub Desktop.
Ignite talk conversion from PDF to PNG
#!/bin/bash
# Put all PDF in a single numbered directory on its own (from 01...)
# Change the upper limit here to the number of directories created
# Expcet Ignite style talk (that is 20 or so slides)
for i in {01..13}
do
cd $i
# find filename
name=`find -type f -name "$i*.pdf"`
name=${name##*/}
name=${name%.pdf}
echo ${name}
# delete exisiting files
for f in ${name}-*.png
do
[ -f $f ] && rm "$f"
done
# convert
convert "${name}.pdf" "${name}.png"
# change numbering
for i in {0..9}
do
mv "${name}-${i}.png" "${name}-0${i}.png"
done
# back to base
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment