Services->PDF2JPG (Automator/Bash)

Esa(Lackluster)Ruoho
2 min readNov 4, 2023

--

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.

  1. Start up Automator
  2. Create a Service
  3. Set the Service to receive selected PDF files in Finder.app.
  4. Then add a “Run Shell Script”.
  5. Make sure the Shell is set to /bin/bash and the Pass input to as arguments.
  6. Wipe whatever the Run Shell Script currently says.
  7. 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!

--

--

Esa(Lackluster)Ruoho

Electronic music composer, free-energy archivist/librarian. Some form of thinker.