Using 'Sips' vs. 'Image Events'...

Hi,

I wanted to start playing with Image Events to get the hang of it, and that got me into playing around with Sips in the Terminal. Since IM uses Sips, I got to wonder if there is a difference (performance, or otherwise) between performing tasks with it, or directly with Sips with “do shell script…”.

Let’s say I wanted to do something simple, like get the resolution of an image. An Image Events script would look like this…

set x to (choose file)
tell application "Image Events"
	launch
	set theFile to open x
	set theRes to resolution of theFile
end tell
set theRes to item 1 of theRes as string

--result: "72.0"

…while a Sips script would look like this:

set x to POSIX path of (choose file)
set theRes to last word of (do shell script ("sips -g dpiHeight " & x as string))

--result: "72.000"

So, I guess I’m wondering: Why use Image Events at all, when you can dive straight into Sips and accomplish the same thing with less code? Are there any real differences in the final scripts? Thanks 8)

Last time I used IE/sips, performance was the same, since invoking “sips” was the same than invoking IE: an app was launched background. Seems that “sips” doesn’t work as “cat” or “ls” (a compiled unix binary), but as a launch-able application. Also, bugs were the same. So, I don’t see many differences, except for the syntax…

I’ve been developing some automated processes in a marketing environment, mostly to create thumbnails and different formats of high-quality TIFF images, and naturally SIPS is a better fit for me since I would have to access Applescript through a command line anyway.

But I’ve been having a heck of a time finding further documentation on and examples of SIPS usage, and have been running into errors trying to make RGB JPEGs of CMYK TIFFs. Any resources someone can point me to?

Since you are using the command line, I would get myself image magick, its functionality goes way beyond that of sips.

I am assuming that you already have some unix command line experience because I believe image magic requires some terminal experience to get it up and running.

Probably the easiest place to start would be to look for image magick on version tracker.

Kevin

Actually, ImageMagick was my original choice, but I’ve been having a lot of problems getting color conversion to work properly, and have been getting LCMS errors. The resulting images have a green cast and are suitable for very small thumbnails but not much else.

Since SIPS is designed to work with color profiles as well, I had hoped that it would have some kind of color space shifting capabilities, but so far it seems like that’s not the case. Maybe in 10.4?