Working smarter with Actions
Hans Weichselbaum continues his series on working with Actions when you’re editing and formatting your images
Working on your photos is fun, but, after a while, you will have noticed that you repeat the same steps over and over on most of your images. Then there is the danger that you might get distracted and leave out an essential step in your workflow — or even perform the same one twice. Most important, there is the matter of time: do you really want to spend hours renaming and resizing your shots when you could do something more productive?
Last time, in Issue No. 213, we looked at the basics of writing and running a Photoshop Action. In this article, I want to take you a step further, look at some more-complex Actions, and introduce you to scripting. Even if you have never written a single Action, you’ll certainly have used some — every time you’ve made a contact sheet, pulled up the Lens Correction filter, or stitched your panoramas with Photoshop’s Photomerge.
Think of something that you do all the time — wouldn’t it be nice to achieve the same result with a single mouse click? For example, you may need to centre a layer horizontally and vertically relative to the page. Doing it manually, you’d choose Edit > Select All, pick the Move tool, and click the two Centre Horizontally and Centre Vertically buttons on the Options bar. If you work from an Action, you can do the lot with one click or a keyboard shortcut.
An Action can be anything from one step that simply reaches a hidden command quickly to dozens of complex steps that combine a variety of operations from different menus.
To start recording your Action, you need an open file. Make a duplicate of the image to have a dummy file to work on — that way, the original document won’t get damaged.
If one of your Action steps is to click on a layer named Layer 1, then the Action is internally recorded as ‘click the layer called Layer 1’. If you run this Action on a different file that hasn’t got a ‘Layer 1’, Photoshop will simply sit there and look at you — so if you want to activate specific layers, you’re better off learning the keyboard shortcuts that will let you go to the next layer up, the next layer down, the bottom layer, etc., rather than incorporating them into your Action.
If you want your new Action to run on a folder full of images, you’ll need to start with a File Open command and finish with a File Save command — and don’t forget to have File Close as your last step, otherwise you’ll get dozens, or even hundreds, of images piling up on your screen! When running the Action, you’ll need to navigate to File > Automate > Batch. We looked at the Batch command interface in the last article.
If you use certain tools in your Action, Photoshop remembers the tool’s position within the image by saving its coordinates.
A practical example
Another way to position a layer is to use the Align Layer controls and then manually move the layer to the position you want it. For example, if you want to place a watermark with your copyright information in the corner of all your images — say, in the right-bottom corner, 10 pixels away from the sides (as seen in Image 1), this can be done with the following steps: 1. Type in your text. 2. Next, you need to ensure the watermark will align properly for both landscape and portrait shots: select both layers, the text and the background layer, in the Layer palette by clicking on them with the shift key pressed. Then select ‘Link Layers’ under the Layer menu. 3. Grab the Move tool from the toolbox. This tool gives you a couple of choices for the layer alignment in the Tool menu bar (see Image 2). With those controls you can align the text layer to the middle or to any side of your image. 4. Click on the text layer, then use the keyboard arrow keys to move the watermark a certain number of pixels away from the image edges. These steps, built into an Action, will guarantee the exact placement of your watermark, wherever you want it, independent of the aspect ratio of the image.
In the last issue, we looked at ‘conditional steps’, which involves an Action branching into two separate Actions, depending on a certain condition. Scripting can take you to a new level. With scripts, you can do anything from creating a new document with a specified size to automatically applying filters and effects on an entire directory tree. Scripts work equally well in Illustrator, in which you can create path items, symbols, and other art. In text applications, you can quickly change the font, font size, justification, or any number of properties. Another script will take a chunk of text, run it through a translator, and replace the original text with all the original formatting.
However, in this article, we only look at a few scripts that are most useful to us photographers,
and you’ll find them already on your computer under File > Scripts. But you will also find some ready-made scripts in the File > Automate menu. Some examples include Fit Image (for resizing images), PDF Presentation (to make PDFs for print output or slide shows), Contact Sheet, Merge to HDR (high dynamic range), and Photomerge (to merge panorama shots or multiple scans).
Now, let’s have a look at the ready-made scripts that you will find under the File > Scripts menu (Image 3). Probably the most important and useful script is the Image Processor.
The Image Processor
In the last article, we looked at the Fit Image command to resize both landscape and portrait shots to a fixed size for your web gallery. Adobe’s Image Processor (seen in Image 4) is an even niftier way for automatic resizing. It is also a cool solution for converting your images into JPEG, PSD, and TIFF formats, and this will save you tons of time.
It gives you control over the JPEG compression and automatically converts to the sRGB colour space. And if that isn’t enough, you can also run an Action at the end — for instance, to sharpen your images. It even allows you to add your copyright information!
The Image Processor can also be directly accessed from the Bridge via Tools > Photoshop > Image Processor.
Other scripts under the File menu
Some of the other ready-made scripts are:
• Delete All Empty Layers: if you love to work with lots of layers, it might not be a big surprise when you end up with lots of empty layers. This little script will reduce the clutter from your layer stack. Only empty layers will be affected; dummy-type or shape layers (without any visible content) won’t be deleted.
• Flatten All Layer Effects: the idea is to make layer effects, such as Stroke, Drop Shadow, etc., permanent. This is not something I recommend, as I am a great fan of keeping my images in an editable state. Some people, however, have found that the layer effects don’t display properly after flattening an image. My suggestion is to try Save As and make a flattened copy to see what happens.
• Flatten All Masks: again, this is not a step I recommend, because it’s always better to work non-destructively and keep all your masks.
• Export Layers or Layer Comps to Files: this is particularly useful if you have different interpretations of an image sitting in separate layers. This command will split them into individual files.
• Script Events Manager: this script comes in handy if you want to make something happen every time you perform a particular task. For example, if you want to convert the background layer into a Smart Object every time you open a document, you’d start by recording a simple Action that simply converts the background layer into a Smart Object. In the Script Events Manager you’d choose the event you want to work with — in our case, Open Document — then select the Action you want to run when the event happens.
• Load Files into Stack: this script (seen in Image 5) is a great way to automatically load a series of images into a multilayered document. If you select camera RAW files, they are loaded according to the last settings you applied, or the default settings if you haven’t previously processed them. You can ask Photoshop to Attempt to Automatically Align Source Images (note that Adobe uses the word ‘attempt’ as a built-in disclaimer, in case it doesn’t work). If you click the second checkbox, the stack of layers gets converted into Smart Objects.
Bridge has some automated functions, which, in some ways, are superior to similar tasks offered in Photoshop. For example, Photoshop’s automated Contact Sheet II command creates a layout of thumbnails, but you need to run the entire process to see the end result. If you don’t like it, you have to start all over again. In Bridge, you can use the Output Module and get all the options such as paper size and image layout. You can try different settings and see straight away what the contact sheet is going to look like.
As Photoshop gets smarter with every new version, it allows you to increase your efficiency and productivity. Have a look at Actions, Droplets, and Scripts — this will quickly convince you to spend your time on more creative work. Looking at other people’s Actions and analysing them step by step is a great way to learn about Photoshop and how to achieve a certain effect.
Scripting takes automation to the next level. You will love it if you have programming skills, but chances are that you will be able to find ready-made scripts to suit all your needs.
Image 1 — Using an Action to add copyright information
Image 2 — The Align Layer controls for the Move tool
Image 4 — The Image Processor
Image 5 — The Load Files into Stacks
Image 3 — Photoshop’s built-in scripts