Photoshop Scripting using JavaScript
I first began scripting Photoshop in CS. Photoshop CS2 takes scripting even further. Adobe Bridge is even scriptable, so it's possible to run scripts from Bridge itself.
It's a really powerful feature that most Photoshop users have no idea even exists. I realized there wasn't a lot of information on the subject on the web, so I decided to share what I learn here.
Why JavaScript? You can script Photoshop using AppleScript and VisualBasic, but JavaScript has two advantages: it's cross-platform friendly and a lot web designers are already familiar with it.
There are advantages to using AppleScript and VisualBasic as well that I hope to cover in the future.
Tips
- Hacking Layers to Files to support PNG
- Converting a document's profile to sRGB for Save For Web
- Setting attributes while creating a New Document
- Add scripts to Bridge
- Targeting Photoshop with a script
- Triggering a script using a keyboard shortcut
- Using Terminal to get a path
- Installing and using the ScriptingListener plug-in
- Using an 'include' to reference an external script
Scripts
- Layers to PNG
- Converting to sRGB for Save For Web
- Create New Document
- Create Frames from Layers
- Reveal All
- Close all open docs without saving
- Turn off the preference for "Resize Image During Paste/Place"
- Turn on the preference for "Resize Image During Paste/Place"
- Create a .log file
- Get the active document name
- Open a folder of documents
- Get the time and date
External Links
Scripts
- Photoshop Scripts - From Adobe Studio Exchange
- Bridge Scripts - From Adobe Studio Exchange
- Photoshop Scripts - Trevor Morris Photographics
- Dr. Brown's Services - By Russell Brown
- Photoshop Scripting - By MLK
- Scripts for iPhoto & Photoshop - These scripts use AppleScript to automate tasks between iPhoto and Photoshop.
- Do Photoshop Action - This script will open the selected images one at a time in Adobe Photoshop, perform an indicated action, and then save the image to a chosen location
- Prepare Images for iDVD - This script will open the each of the selected images in Adobe Photoshop, scale them to 640 x 480 and then overlay any comment text at the bottom of the image! When all the images have been processed, they are then opened in the Preview application as a catalog for quick perusal
- Importing 16-bit image sequences - By Dave Nagel
- Rank & File - Rank and File Can write the Star Ratings into the IPTC keywords of an image file, so that other programs can see and use this valuable information
- DAM Useful - Pimp my Bridge - Scripts for Adobe Bridge
- Photoshop Automator Actions v3.0 - by Ben Long. An amazing set of useful automation scripts to streamline Photoshop tasks.
- BarredRock Software - Scripts for Bridge that include: Color Mode, Export Metadata, Convert Images and Flipper.
- ACR Calibrator - is a Photoshop CS2 script to automate the process of calibrating Adobe Camera Raw (ACR). It requires a raw digital capture of the GretagMacbeth 24-patch ColorChecker.
- Siva's Photoshop Conditional Action - script for Photoshop CS2 that will run actions based on various conditions including: File Format; Height; Width; Resolution; Color Mode; etc.
Scripting Forums & Tutorials
- Photoshop Scripting Documentation - Official Adobe Documentation. This is the best place to start. Adobe's documentation on scripting has been much improved for CS2.
- Bridge Scripting Documentation - Official Adobe Documentation.
- Photoshop Scripting Forum - Official Adobe Forum.
- Adobe Studio - Script Exchange - A place to share scripts as well as many other Photoshop presets.
- PS Scripts Forum - Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General
- Scripting and Actions Tutorials - Trevor Morris Photographics
- Scripting Matters - An AppleScript web site with conferences on scripting Adobe applications.
- What's New In Photoshop CS2 Scripting - By Tom Fors
- Script Events Manager from Start to Finish - by Matt Kloskowski, Photoshop User Magazine
- Working With Photoshop Scripts - by Jennifer Apple
- Scripting Photoshop CS with C# & Photoshop Constants Rosetta Stone
- Introduction to Scripts and Actions Events Manager in Photoshop CS2
- CS UI Builder 1.0 & CS UI Builder 2.0 Alpha - Flash app that generates code for Script UI
Books
- Photoshop Speed Clinic: Automating Photoshop - by Matt Kloskowski. 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.
- Adobe Photoshop CS2 Official JavaScript Reference - If you like having a physical desk reference, or a textbook for students, this is a printed/bound version of the available Photoshop JavaSccript Reference (PDFs) that ship with Photoshop.
- Adobe Scripting: Your Visual Blueprint to Scripting in Photoshop and Illustrator - A well written book by Chandler McWilliams, a Design Technologist at a cool design shop called The Chopping Block. The Chopping block helped design many of the web gallery templates in Photoshop CS and CS2. I hope Chandler writes a follow up to this book.
- JavaScript: The Definitive Guide - A great JavaScript reference guide by David Flanagan. This book mostly deals with the web browser Document Object Model (DOM) rather than Photoshop's DOM.