3

I am creating this service for Finder that will receive image files and pass to a shell command.

The idea is this:

  1. I select image files on finder.
  2. I right click and choose the service I am creating
  3. the service receives the files and passes to sips, so it will scale the images to a given size.

this is how I created it.

sips would run on terminal if I type

sips -z 750 1334 *.png   (or any other extension, including *.*)

I am hoping that $* would pass a list of arguments to sips, but this is not working.

How do I do that?

enter image description here

2

I found a following solution that works for me:

for f in "$@"; do
  sips -z 750 1334 "$f"
done
  • nice one, glad you found a solution that works for you. For us who do not understand, what does it do ? (why $f) but you got a + anyway :) – Ruskes Nov 7 '14 at 20:28
  • good question, but it works! thanks anyway +1 to you too! – SpaceDog Nov 7 '14 at 20:50
  • $f comes from the f in Line 1: for f ...; Line 1 pseudocode: for {each file} in {input list of files} – Jake Berger Jun 6 '17 at 22:50
  • to resize by width only (maintaining aspect ratio), another option is to use sips --resampleWidth 750 "$f" – JeremyDouglass Apr 16 '18 at 0:56
1

You're looking for $@:

sips -z 750 1334 "$@"
  • not working. I have found an answer. See my answer. – SpaceDog Nov 7 '14 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .