#!/bin/bash

convert -trim $1.pdf ../$1.jpg

rm $1.pdf

if [ -e ../$1-0.jpg ]
then
    mv ../$1-0.jpg ../$1.jpg 
    rm ../$1-1.jpg
fi
