Romancing Photoshop

Well, it wasn’t wining and dining, or even whining and dhining, but it was success.

As I’ve been trying to write code to replace the JAlbum-based photo albums on the site, I’ve been struggling with getting Applescript code to make Photoshop do what I want it to. There were a whole slug of things I bumped into over the last few weeks of learning and experimentation. Most of it was driven by wanting to use the “Save for Web” functionality in Photoshop CS2 without do Automator actions, or some other method that would be likely to change with any change to the GUI of CS2.

Why was this important?

‘Cause when PS CS2 finished manhandling my thumbnails, they were over 80k each! Using “Save for Web” manually in CS2, I could get them in the 8k range, and that’s where they needed to be. After all, if you can draw a picture faster than the site can come up, what’s the sense in having the site? 🙂

I have searched high and low for this functionality through Applescript, and hadn’t been able to get quite close enough. There were lots of alternate paths, and I expect that some far-off, distant corner of the web has this documented somewhere, but I never could find it.

All the scripting PDFs from Adobe alluded to a “export options save for web”, but I could never get that class to work using a save command in the script. As it ends up, the “Save for Web” functionalty is accessed via an export, rather than a save. It’s as simple as:

set myOptions to {format:JPEG, quality:100, optimized size:true}

export current document in file applyFileNewName as save for web with myOptions

That’s it. Just that easy. Once I get the code ready for making the photoalbums, I will be posting it. Hopefully someone else can use it too. I still have a lot of things to tidy up before I can start generating the photo albums programatically, but this is a HUGE step in that direction!

(BTW, there’s no dis to David of JAlbum fame. JAlbum is terrific code — I just can’t support my habit of shooting RAW files with it natively. I have to convert my RAWs to JPGs, and then let JAlbum process them, and I’m trying to streamline my workflow as best I can.)