Services->PDF2JPG (Automator/Bash)
Hi, I had this simple problem recently — I just needed to take a regular single-page PDF and switch it to a JPG. And place it onto the same folder.
I went online, and found a multitude of solutions. Some were really convoluted, others were simple, but mucking around with Automator, I wasn’t able to figure out any that worked.
Then I came across one post, and decided to regurgitate it here.
What you need is sips, Automator and a PDF.
- Start up Automator
- Create a Service
- Set the Service to receive selected PDF files in Finder.app.
- Then add a “Run Shell Script”.
- Make sure the Shell is set to /bin/bash and the Pass input to as arguments.
- Wipe whatever the Run Shell Script currently says.
- Input
for f in “$@”
do
/usr/bin/sips -s format jpeg “$f” — out “${1/.*/}.jpg”
done
Save the Service as something descriptive, such as Single Page PDF to Single JPG or SimplePDF2JPG or something like that.
Ok, so.. What does this actually do? It outputs a regular JPG out of a PDF. If your PDF has 300 pages, only the first page will be re-created as a JPG.
You could easily replace “jpeg” with “tiff” and follow that by replacing “.jpg” with “.tif”.
This does a very specific simple thing, and nothing else, no frills, no extras.
I just hope someone else will have less trouble than I did, finding how to take a PDF, convert it to images, and have the image pop up in the folder you ran the service in.
Good luck!