Jeff Tranberry's Photoshop Crawlspace

June 20, 2008

Creative Suite Scripting Survey

Please take this Scripting Survey to help us understand how you use ExtendScript, JavaScript, ActionScript, AppleScript, VBScript and other scripting languages with Photoshop and the Adobe Creative Suite.

03:29 PM | Permalink | No Comments

April 10, 2008

New Photoshop Scripting Goodness

Trevor Morris, of Morris-Photographics, has posted two great articles on scripting Photoshop:

Scripting Photoshop, Part 1 — An Introduction

Scripting Photoshop, Part 2 — A Practical Example

Trevor also writes custom scripts for hire.

Tom Ruark and I presented at Photoshop World Orlando last week. The new class files are located here.

Dr. Brown's Services has been updated to 1.9.4.

Not related to scripting: Be sure to check out Adobe TV. Russell Brown and Julianne Kost already have videos posted. Let us know what kinds of things you'd like to see there from the Photoshop team.

03:55 PM | Permalink | No Comments

September 21, 2007

Awesome Scripts for Photoshop CS3 and Bridge: Dr. Brown's Services 1.9.2

Russell Brown has produced a great collection of FREE workflow scripts for Photoshop CS3 & CS3 Extended in Dr. Brown's Services 1.9.2 which he announced at Photoshop World, Las Vegas earlier this month.

"Background Remover," "Interpret Video," "Fit Video to Audio," and "Slide Show" scripts all take advantage of Photoshop CS3 Extended's spanking new video capabilities. Fit Video to Audio and Slide Show are especially nice for allowing photographers to easily make video slideshows with music.

"Stack-A-Matic" is another script to take advantage of CS3 Extended and it's new Smart Object Stack Modes. If you haven't checked out Stack Modes, check out the tutorial video Russell has provided, and Martin Evening's tutorial over at Photoshopnews.com and open yourself up to new way of shooting and manipulating images.

If you want to save time on your next Photoshop project, do yourself a favor and head over to russellbrown.com and download Dr. Brown's Services 1.9.2!

For all you scripters out there, there's a wealth of code to learn from in Dr. Brown's Services, everything from manipulating the Animation (Timeline) palette to working with Smart Objects.

I'll also point out that Photoshop ships with a folder of simple sample scripts in the "Scripting Guide" folder in the Photoshop application folder. However, some of the best example code, showing you how to tie it all together, can be found in the scripts that are increasingly becoming part of Photoshop - Image Processor, Merge to HDR, Photomerge, Export Layers to Files, and any of the Layer Comps workflow scripts. You can find these scripts in the Presets>Scripts folder inside the Photoshop CS3 application folder.


09:32 PM | Permalink | Comments [1]

June 03, 2007

Photoshop Scripting Sessions @ Photoshop World Las Vegas

The class schedule for Photoshop World Las Vegas, September 6-8, 2007 has been posted. I'm happy to announce that there are not one, but two, Photoshop Scripting Classes this time around:

Thursday, September 06

01:00p-02:45p - Photoshop Scripting (Beginners) - with Jeff Tranberry:
“Do you think Scripting is just for geeks? Photoshop offers a world of new possibilities to those who are familiar with writing scripts to automate and extend Photoshop. In this session you’ll learn the basics of scripting in Photoshop CS3 using Javascript and examine some real world examples of how you can make use of these basics to push Photoshop even further.”

03:00p-05:45p - Photoshop Scripting (Intermediate, Hands-on Workshop) - with Tom Ruark:
“In this session you’ll learn the how to write and debug more complex scripts using the Adobe ExtendScript Toolkit. You are encouraged to bring your own laptop to participate in the class workshop, where you can put your skills to work writing your own scripts with the help of the instructors. Class participants can then share their creation during a final show-and-tell discussion.”

We did a Beginners session at Photoshop World Boston back in April. This time Tom Ruark, a Computer Scientist at Adobe, who is responsible for the SDK, plug-in API, and scripting API for Photoshop, will show some more advanced stuff during the intermediate session. Tom and I will be on hand for both sessions, so come by and check it out.

07:21 AM | Permalink

August 31, 2006

Photoshop Batch processor: XBatch

xbytor and Uwe Steinmueller have released XBatch, a Photoshop batch processor that maintains the folder hierarchy of the original images for the processed images.

xbytor is a script junkie that doles out useful Photoshop scripting advice over at PS-Scripts.com. Check out his Introduction to Photoshop Scripting. Uwe Steinmueller runs outbackphoto.com.

04:56 PM | Permalink

May 09, 2006

Installing and using the ScriptingListener plug-in

Not all operations are scriptable using Photoshop's built-in methods. There are a couple of ways to get around this. One is calling a Photoshop Action from your script:

// Which Action(s) to run
doAction("My Great Action","Default Actions");

If you plan to share scripts with other users, this method requires that other users install the script and any Actions the script calls in order to run the desired operations.

The second is using the ScriptingListener plug-in to capture Javascript created by Photoshop to build Actions and incorporate this code directly into your script.

listernerIcon.jpg

Installing the ScriptingListener plug-in:

Quit Photoshop

Locate the ScriptingListener plug-in inside Photoshop's application folder:

  • Adobe Photoshop CS2>Scripting Guide>Utilities>ScriptingListener

Drag the ScriptingListener plug-in into the folder 'Automate' in Photoshop's Plug-Ins folder:

  • Adobe Photoshop CS2>Plug-Ins>Adobe Photoshop Only>Automate

Launch Photoshop

Using the ScriptingListener plug-in:

As you work in Photoshop, the ScriptingListener plug-in records Javascript for any operation which is Actionable to a log file named ScriptingListenerJS.log, which by default is saved to the desktop on Macintosh, or to the root of your C:\ drive on Windows.

listenerLog.jpg

To determine if an operation is Actionable, double-click the ScriptingListenerJS.log file to launch the Console application. Keep the Console window view of the ScriptingListenerJS.log visible as you are working. You will see the log update if the operation you just performed is Actionable. Painting, for example, is not an Actionable operation. You can click 'Clear'' at any point to clear the entries in the log.

script-Log.gif

As you will notice, the Javascript which is recorded by the ScriptingListener plug-in isn't always easily read or clearly labeled.

For Example, here is some ScriptingListener Javascript for generating a guide:

// =======================================================
    var id8 = charIDToTypeID( "Mk  " );
    var desc4 = new ActionDescriptor();
    var id9 = charIDToTypeID( "Nw  " );
          var desc5 = new ActionDescriptor();
      var id10 = charIDToTypeID( "Pstn" );
      var id11 = charIDToTypeID( "#Rlt" );
      desc5.putUnitDouble( id10, id11, 72.000000 );
      var id12 = charIDToTypeID( "Ornt" );
      var id13 = charIDToTypeID( "Ornt" );
      var id14 = charIDToTypeID( "Vrtc" );
      desc5.putEnumerated( id12, id13, id14 );
    var id15 = charIDToTypeID( "Gd  " );
    desc4.putObject( id9, id15, desc5 );
  executeAction( id8, desc4, DialogModes.NO );

Try to get in the habit of recording one step at a time and commenting each operation so you know what it does. I generally record the operation a few times with different settings so I can see where the settings change in the code. In this case, I've determined that 72.000000 refers to the pixel position of the guide, and that "Vrtc" is used for vertical guides and "Hrzn" is used for horizontal guides.

Here is the code with some comments:

// Create Vertical Guide
/*This javacript creates a vertical guide 72 pixels in from the left edge.*/
    var id8 = charIDToTypeID( "Mk  " );
    var desc4 = new ActionDescriptor();
    var id9 = charIDToTypeID( "Nw  " );
          var desc5 = new ActionDescriptor();
      var id10 = charIDToTypeID( "Pstn" );
      var id11 = charIDToTypeID( "#Rlt" );
      desc5.putUnitDouble( id10, id11, 72.000000 );
      var id12 = charIDToTypeID( "Ornt" );
      var id13 = charIDToTypeID( "Ornt" );
      var id14 = charIDToTypeID( "Vrtc" );
      desc5.putEnumerated( id12, id13, id14 );
    var id15 = charIDToTypeID( "Gd  " );
    desc4.putObject( id9, id15, desc5 );
  executeAction( id8, desc4, DialogModes.NO );

You can also turn the Javascript that the ScriptingListener plug-in generates into your own functions. You can even pass in your own variables. In this case, we pass in an integer for pixelOffSet and the string "Vrtc", "Hrzn" for orientation:

function makeGuide(pixelOffSet, orientation) {
    var id8 = charIDToTypeID( "Mk  " );
    var desc4 = new ActionDescriptor();
    var id9 = charIDToTypeID( "Nw  " );
          var desc5 = new ActionDescriptor();
      var id10 = charIDToTypeID( "Pstn" );
      var id11 = charIDToTypeID( "#Rlt" );
      desc5.putUnitDouble( id10, id11, pixelOffSet ); // integer
      var id12 = charIDToTypeID( "Ornt" );
      var id13 = charIDToTypeID( "Ornt" );
      var id14 = charIDToTypeID( orientation ); // "Vrtc", "Hrzn"
      desc5.putEnumerated( id12, id13, id14 );
    var id15 = charIDToTypeID( "Gd  " );
    desc4.putObject( id9, id15, desc5 );
  executeAction( id8, desc4, DialogModes.NO );
}

Then you can simply call the function every time you want to use it:

makeGuide(100, "Hrzn");

Using an 'include' to reference an external script

Another neat trick is to move all of your own functions created using the ScriptingListener into an external .jsx file. Then you can use an 'include' to reference the .jsx file with all your functions, keeping the script your working on neat and tidy.

Save your functions in a file 'myFunctions_lib.jsx' in the Photoshop's 'Scripts' directory:

  • Adobe Photoshop CS2>Presets>Scripts

Next create a new script. Use an 'Include' to reference 'myFunctions_lib.jsx' file:

// Includes an external .jsx file

// @include 'myFunctions_lib.jsx'

Note: the 'Include' code will execute even though it looks like a comment.

Call the function 'makeGuide' from the 'myFunctions_lib.jsx' file:

makeGuide(100, "Hrzn");

Save the file as 'my_script.jsx' in the Photoshop's 'Scripts' directory:

  • Adobe Photoshop CS2>Presets>Scripts

Run the script called 'my_script.jsx'.

If you want to comment out an 'Include' you can comment it using /* */.

// Includes an external .jsx file

/*// @include 'myFunctions_lib.jsx'*/

02:30 PM | Permalink | Comments [4]

April 11, 2006

Siva's Photoshop Conditional Action

Sivaratnam Gunaratnam has created an “Image Processor“-like script for Photoshop CS2 that will run actions based on various conditions including:

  • File Format
  • Height
  • Width
  • Resolution
  • Color Mode
  • etc.

I haven't tried every condition, but it seems to work as advertised, even if the UI is a little ragged.

09:36 PM | Permalink | Comments [2]

CS UI Builder 2.0 Alpha

Jakub Kozniewski, creator of the Flash application “CS UI Builder 1.0,” has released a Windows only “CS UI Builder 2.0” alpha. This WYSIWYG tool helps create some of the javascript layout code for Script UI dialogs for Photoshop. Jakub has added support for some new controls and icons within dialogs.

CSUIB 2.0 alpha is available at http://www.jkozniewski.com/tools/CSUIB_2.0a.zip

08:58 PM | Permalink | Comments [1]

April 08, 2006

Photoshop Speed Clinic: Automating Photoshop

Photoshop World Miami was a blast this year. Matt Kloskowski's “Photoshop for Geeks” session was filled to the gills. It's great to see that people are interested in ways to simplify and automate their workflows through scripting.

Matt has kindly provided his article on the Script Events Manager from the January/February issue of Photoshop User magazine, and a list of Photoshop scripting resources:

Scripting Resources (PDF)
Script Events Manager article (PDF)

I should also mention that Matt released his new book at Photoshop World: “The Photoshop CS2 Speed Clinic : Automating Photoshop to Get Twice the Work Done in Half the Time.”

The book was a hot item at the show and sold out from the Peachpit Press booth almost as soon as they hit the shelf. Of course, copies are still available through Amazon and most bookstores.

The book covers automation using actions and batch processing, strategies for smarter actions, streamlining Camera Raw & Bridge workflow, Smart Objects, and a chapter on scripting.

The scripting chapter includes information on:

  • Installing and using scripts
  • Editing scripts in the ExtendScript Toolkit
  • Using the Scripts Event Manager to automatically run scripts and actions
  • Installing & using the Scripting Listener plug-in
05:03 PM | Permalink

March 01, 2006

Extending Applications

Adobe Photoshop and Bridge has opened the doors to users and third party developers to extend our applications through scripting.

Peter Krogh's Rapid Fixer and Lexar's recently announced Smart Download are commercial examples.

Thomas Fors recently updated his ACR Calibrator script to work with Adobe Camera Raw 3.3.

Photoshopnews.com has a script that lets users browse the Photoshop News website right inside of Bridge without using a web browser or RSS news reader.

BarredRock Software has an interesting collection of scripts for Photoshop, Bridge and Illustrator.

Yahoo Widgets (formerly Konfabulator) has a script that takes your layered Photoshop document and makes a fully functional Widget out of it.

Apple has two scripts for iPhoto to interface with Photoshop: Do Photoshop Action & Prepare Images for iDVD.

Extending applications isn't limited to the Creative Suite - Check out this third-party developed extension that gives Fireworks Photoshop's Layer Comps functionality.

People are even finding creative ways to extend Adobe Lightroom to work in tethered workflows. Watch it in action.

11:16 PM | Permalink | Comments [2]

February 24, 2006

Photoshop For Geeks

It's that time of the year again. Time for Photoshop World. If you were at the last Photoshop World in Boston, you might have attended Matt Kloskowski's Photoshop After Dark session entitled "Photoshop For Geeks" which focused on scripting Photoshop. If you weren't there, you missed out on a fun session.

I stuck around afterward to talk with people who were interested in learning more about scripting. The thing that struck me was that a lot of the interest came from web folks, particularly people familiar with Macromedia's ActionScript. The comments were along the lines of, "Hey, that looks like ActionScript! - I could do that! - and it would save me a ton of time at my job!"

Well, since Photoshop World Boston, Adobe has completed it's merger with Macromedia. We can actually start dreaming how scripting Adobe applications might play with Flash and Flex, and how we can work with the incredible Macromedia development community.

If you're interested in chatting, I'll be at Matt's Photoshop For Geeks session, Wednesday, March 22nd, 8:30-9:30pm. Stop by and say hello.

I also wanted to point out that Shane Stanley and Ray Robertson will be putting on their AppleScript Pro Sessions in the New York City area, May 8-12, 2006. These sessions focus on using AppleScript to drive the Adobe Creative Suite (InDesign, Illustrator, Photoshop and Acrobat) along with the finder and other applications.

Happy scripting!

10:26 AM | Permalink

January 06, 2006

Photoshop Scripting to the Rescue

Over my Holiday vacation, I received a somewhat frantic call from a friend who works at a prominent arts center. They had 1100 images for a book that was to go to press in the next few days that they had decided were of unacceptable color. The unacceptable color was introduced by an "aftermarket raw-to-tif converter" used by a contract worker, and they now wanted to redevelop all the files in Adobe Camera Raw.

The problem was, the resulting TIF files had been renamed and dropped into the layout already. They needed to match the renamed, off-color TIFs to the corresponding raw versions to rename and reprocess them.

To do this by hand, they figured they'd need no less than 20 hours of labor. Being familiar with scripting Photoshop through a free "Intro to Photoshop Scripting" class I had presented, he thought this would be a perfect opportunity to leverage scripting and called me.

We determined that the way we could match the images was by the Date Time Original EXIF metadata. Trouble is, the date format in developed versions of the TIFs was different as it had been modified by the "aftermarket raw-to-tif converter."

I sat down and pseudo-coded a script.

1) We needed to format the times so they were in the same format
2) We needed to build an array of the Date Time Original and the file names of the bad files through a for loop
3) We needed to process and rename the raw files using another for loop

The arrays were a little tricky for me, so enlisted the help of another one of my buddies. He also pointed me in the right direction for using "Regular Expressions" to touch up the Date Time Originals to match.

After spending the evening working up the script with my buddy, I headed over to the museum in the morning to try it out. The script ran perfectly in 52 minutes flat on a dual 2.7 G5.

It was another "Good Day."

04:38 PM | Permalink | Comments [1]

October 19, 2005

Scripting Matters

Scripting matters, right?

I think so, but where is all the training? Photoshop has traditionally been spoiled when it comes to good training. Look at any bookshelf and there's a plethora of books on Photoshop to choose from. There's lots of Photoshop training sessions out there, too.

So, what's out there for scripting?

Chandler McWilliams wrote a book called "Adobe Scripting" a few years back which I thought was a great introduction to scripting Photoshop.

Last September's Photoshop World in Boston featured it's first session dedicated to scripting - "Photoshop For Geeks" by Matt Kloskowski, a NAPP trainer. Granted the session was from 9pm-10pm, but there were hundreds of people who showed up and were excited by scripting.

Scripting Matters, Inc., from who I stole the title of this post from, is hosting a 5-day seminar called "AppleScript Pro Sessions" in Chicago, IL, October 31st through November 4th. Shane Stanley and Ray Robertson host the session. The sessions will focus on AppleScript, and involve using AppleScript in conjunction with InDesign, Illustrator, and Photoshop.

I would love to go to this event, but I will be in San Jose for work the same week. If anyone attends the event, let me know what you thought of it.

Here's my call to action: My fellow Photoshop enthusiasts, ask not what scripting can do for you: Ask what you can do for scripting.

The more authors, trainers, and users we have on board the better. Even yours truly posts a scripting tip or tutorial from time to time.

So tell me, what other scripting training have people found out there?

09:21 AM | Permalink | Comments [19]

October 14, 2005

Scripting UI Tool

A resourceful Flash developer, Jakub Kozniewski, created a Flash application, CS User Interface Builder 1.0, to help build interfaces for scripts. Apparently, he is working on a 2.0 version.

It's great to see the Photoshop Scripting eco-system starting to grow. I'm fascinated by Photoshop Scripting the same way I was by web development back when I was in college in the 90's. From the first table I built to the first roll-over I created using JavaScript, each step was exciting, even if things like these are considered mundane by today's standards.

I know I felt that same excitement from my first "Hello, World!" Photoshop Script. It can only get more exciting...

05:14 PM | Permalink | Comments [1]