One of the problems with my old site design was that I used CSS to scale all the images to the right size, instead of making sure they actually fit well. I wanted to get away from that, and took all that CSS out.
But I still had the fundamental problem: the images weren't properly scaled. My first approach to solving this problem was to use the Python Imaging Library, PIL.
Unfortunately, PIL often doesn't detect the jpeg encoder library if you use precompiled versions. Neither my OSX laptop nor my Ubuntu server were able to handle jpegs without recompiling the source.
Because I wanted to go to bed, I wasn't really mentally up for much more thinking. Fortunately, the Automator and its point-and-click goodness came to my rescue.
Although Automator can scale images by default, it only scales them vertically, which wasn't what I wanted. After staring at it for a few moments I hatched my devious (by which I mean, inevitable) plan: rotate the images 90 degrees, scale them vertically, and then rotate them -90 degrees.
Although something certainly feels wrong that this actually works, it does work, amazingly well. Well enough to create a workflow named Size-For-Blog and leave it on my desktop.
Until this point I had ignored Automator, because I have faint memories of using AppleScript to make an icon that looked like the Harddrive run a shut down script when I was in sixth grade, and assumed it would be similarly useful.
But, hey, it's pretty helpful. I'm not sure if it'll be that helpful for my daily tasks, but from now on I'll at least check to see whether that is the case.
Hehe, great and simple workaround to scale the images horizontally!
Next time you want to batch-manipulate images on your Mac, I would recommend using sips, the built-in scriptable image processing system in Mac OS X. AppleScripts' Image Events library is also based on this helpful program. You can learn more about both here:
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/sips.1.html
http://www.apple.com/applescript/imageevents/
If you need any help with AppleScript, Automator or Unix scripting, I kindly invite you to visit us friendly folks over at the AppleScript forums at MacScripter.net.
Best regards from Germany,
Martin Michel The Joy of Scripting
That's a fun workaround for what is a bit of a baffling limitation. I can understand simplifying interfaces, but you can't actually tell what the "Scale" action is going to do until you run it once.
I bumped up against this a while back and ended up using some Automator actions that come bundled with Pixelmator (which I got in one of the Macheist bundles) to get a bit more control over image processing.
Reply to this entry