Trying to use Automator to create thumbnail images for a bunch of PDFs. I want to convert the PDFs to JPGs, then downsize those JPGs. The first step has gone fine, but I've tried a bunch of ways to do the resize and nothing has worked... I'm not sure what I'm missing?
This is working great for the PDF to JPG part:
for f in "$@"
do
sips -s format jpeg -s formatOptions 100 "$f" --out "${f%.pdf}.jpg";
echo "${f%.pdf}.jpg"
done
This is what I'd like to add:
sips –z 200 *.jpg -s formatOptions 100
I've tried adding it as a second line, tried putting just the -z section within the existing line, tried an entirely separate step in Automator...
Would love to work this out. Thank you!
I'm not really sure what you are trying to do, or what the problem is. Here is a simple way of doing what I think you want all in one go:
#!/bin/bash
for f in "$@" ; do
outfile=${f%.pdf}.jpg
sips -s format jpeg -s formatOptions 100 -Z 200 "$f" --out "$outfile"
done
If you want to do it in two steps for some unknown reason, you can use:
#!/bin/bash
for f in "$@" ; do
outfile=${f%.pdf}.jpg
sips -s format jpeg -s formatOptions 100 "$f" --out "$outfile"
sips -s formatOptions 100 -Z 200 "$outfile" --out "$outfile"
done