And finally, I guess, this is basically all I want to use the ImageMagick for:

Image resizing.
Image compression - jpg
Finding image DPI
Finding image size
Clean up image (sharpen, etc.)

Well, other than sharpen, you can actually do all that in Image Events which comes with Mac OS X (10.3?).


tell application "Image Events"
        set img to open file "Zany:Users:peter:Example.jpg"
        set x to {resolution of img, bit depth of img, dimensions of img}
        scale img by factor 0.5
        crop img to dimensions {500, 500}
        save img as JPEG in "Zany:Users:peter:ExampleOut.jpg"
        x
end tell

returns {{180.0, 180.0}, millions of colors, {2272.0, 1704.0}}

Accessing Image Events via AppleScript or AppleEvents can be done from Perl using many different techniques using a lot smaller hammer than ImageMagick.

Not that I would want to dissuade anyone from using ImageMagick, it is very useful, I use it a lot, and I'm one of those who posted the "weary howtos" on getting the darned thing working in Mac OS X's perl, so I certainly wouldn't want to have anyone else miss out on the fun. And Image Events is pretty sucky. But it might be enough to get you started, as long as you keep the image access areas of your code constrained you should be able to change it later and plug in something more powerful.

Another alternative which I've used successfully is to script GraphicConverter or Photoshop.

Enjoy,
   Peter.

--
<http://www.stairways.com/>  <http://download.stairways.com/>

Reply via email to