shell script to change .pdf files to .png Mac OS 10.3

Viewed 12367

I'd like to make a script on Mac OS 10.3 that converts a pdf to a png. I've been looking around but I'm not sure if its even possible. I keep reading about a "sips" command but it doesn't seem to be available on 10.3, or at least this one. I typed man sips in the terminal and nothing came out. I have written a couple bash scripts and kind of understand how they work but was hoping this specific issue at work would be a good way to practice. I could probably write something that changes the name, but I'm not sure that would work in and of itself as the new png file would probably not actually work. Is there a way from the terminal to basically open preview, open each file and then save as a png? that would probably be the best option. Thanks

4 Answers

Use the following shell script.

  1. Make bash file e.g., test.bash

for i in *.pdf; do name=$i; name=${name%.*}; sips -s format png $i --out ${name}.png; done

  1. Enter the command

bash test.bash

Related