Earthbound Light - Nature Photography from the Pacific Northwest and beyond by Bob Johnson
Home
About
Portfolio
Online Ordering
Contact
Comments
Recent Updates
Support

Photo Tip of the Week
CurrentArchivesSubscribeSearch

Intro to Photoshop Scripting

Most photographers tend to be creative people, but sometimes even creative people have to invest a lot of repetitive effort in Photoshop to get the results they are after. After spending the last two weeks discussing actions, it's time to tackle the other principle way to automate Photoshop. It may not be for the faint of heart, but Photoshop scripting can work some powerful magic.

While actions are built around a relatively user-friendly tape recorder or VCR paradigm, scripting in Photoshop exposes you to computer programming in all its pain and glory. While Adobe does provide some tools to shield you from at least some of the complexity, there's no escaping the fact that scripting is programming. Some of you may be well versed in the art of programming and only need pointers in how to get started in Photoshop scripting, but scripting is likely to be the first introduction to programming for many of you. Before you run away and hide though, stick with me and I'll see if I can introduce you at least somewhat gently. I'm not even going to try to replace the detailed documentation Adobe has already provided on scripting. My aim here is as the title implies — to introduce you to Photoshop scripting over the next few weeks.

If you're a regular reader here, you've already seen what scripting can do. One of the most famous scripts for Photoshop is known as the Image Processor and comes with the product. You can find it on the Photoshop menu under File >> Scripts >> Image Processor. Created by that mad Adobe scientist Dr. Russell Brown, the Image Processor will let you easily convert, resize, or perform some action on a bunch of image files, whether those be a few files you happen to already have open in Photoshop or an entire folder containing everything you shot on a recent trip with your camera. If you like what the Image Processor is capable of, you can you can do this and more with scripting.

A script is a series of commands and associated decision points to allow Photoshop to conditionally execute, bypass or merely tweak each command as it runs. It can examine the properties of the current image and change its behavior accordingly based on rules you provide when writing the script. It can run some steps repeatedly or not at all based on what you specify. It can remember key values so it can make use of them later, perform arithmetic, it can create new files, rename or delete existing ones and much, much more.

All this goes far beyond what even the most cleverly written Photoshop action is capable of. You can somewhat think of scripts as being actions on steroids. An action performs a series of steps without variation on a single image. A script can process one or more images and decide what to do on each based on whatever logic you impart to the script when creating it. It can also access things outside of Photoshop and even ask you for input using an interface specifically designed for the task at hand.

A script exists as a simple text file that Photoshop executes to carry out those commands and processing logic. While it would be nice if you could just describe what you want in English, computers aren't yet that smart I'm afraid. Probably someday, but not yet. At least for the time being, for Photoshop to understand what you want it to do, you have to write it in a language it understands. Photoshop (and other Adobe Creative Suite products) support scripting in any of three languages, depending on your operating system: those running Windows can use VBScript or JavaScript, while folks you use Mac OS X can use JavaScript or AppleScript. As you can see, the only language common to both platforms is JavaScript so the general recommendation would be to focus on learning it rather than the other two so that your scripts can be cross platform. If you're already an old hand at VBScript or AppleScript though and don't care about sharing your scripts with those who use an operating system that obviously isn't your preferred one, there's no real reason not to stick with the language you already know. In my discussion of scripting here I plan to focus on JavaScript, but translating to either of the other two languages is relatively straightforward.

If you have a task you need to perform again and again in Photoshop you don't always need to deal with scripting to perform it of course. Many tasks can be automated fairly easily with an action as we've discussed the past two weeks. Another alternative could just be to continue doing things manually. If it takes you longer to figure out how to create a script or action than it would to just knuckle down to and do the whole thing the old fashioned way, it may be preferable not to mess with automation at all. But once created an action or script can be used again and again so that your initial investment in creating it could pay huge dividends in time. And in terms of automating things, scripting is so powerful it can take long series of steps and decisions and wrap them up into a few quick mouse clicks.

Becoming proficient at scripting in Photoshop can require a degree of time and effort. But unlike the repetitive effort all us creative folks seek to avoid by automating tasks, time invested in learning about Photoshop scripting can pay itself back handsomely for those who have a knack for this sort of thing. Heck, if you can learn to use Photoshop in the first place, you may just be able to get the hang of scripting with a bit of help.

We'll take a closer look at the scripting environment and how to create a script in Photoshop next week.


Date posted: May 30, 2010

 

Copyright © 2010 Bob Johnson, Earthbound Light - all rights reserved.
Permanent link for this article
 

Previous tip: More on Photoshop Actions Return to archives menu Next tip: Creating Your First Script in Photoshop

Related articles:
Photoshop CS2's Secret Hidden Image Processor
Lights, Camera, ... Photoshop Actions!
More on Photoshop Actions
Creating Your First Script in Photoshop
Scripting with the ExtendScript Toolkit
Scripting with the Photoshop ScriptListener Plug-in
 

Tweet this page       Bookmark and Share       Subscribe on Facebook via NetworkedBlogs       Printer Friendly Version

Machine translation:   Español   |   Deutsch   |   Français   |   Italiano   |   Português


A new photo tip is posted each Sunday, so please check back regularly.


Support Earthbound Light by buying from B&H Photo
  Buy a good book
Click here for book recommendations
Support Earthbound Light
  Or say thanks the easy way with PayPal if you prefer



Home  |  About  |  Portfolio  |  WebStore  |  PhotoTips  |  Contact  |  Comments  |  Updates  |  Support
Nature Photography from the Pacific Northwest and beyond by Bob Johnson


View Cart  |  Store Policies  |  Terms of Use  |  Your Privacy