Chapter 31. Digital Workflow and Automation

IN THIS CHAPTER

  • Batch processing image files

  • Creating droplets to easily apply actions to files from the file system

  • Using scripts to simplify workflow tasks

  • Assigning actions and scripts to Photoshop events to automate tasks

Photoshop is a powerful application with many tools and utilities that provide limitless ways to create and edit images. Photoshop's power comes with one big drawback: It has so many tools, menu options, and panels that navigating through them can be difficult, especially if you need to perform the repetitive tasks on several files.

To solve that problem, Photoshop has provided several tools that make it possible to automate much of your workflow using batch processing and scripting. Batch processing involves performing the same set of commands on a set of files. Scripting involves applying a script as either a one-time command or each time a workflow event occurs. The following sections discuss utilizing Photoshop's automation and scripting tools to make things easier and speed up image editing.

Automating Workflow in Photoshop

One of the best ways to save time and increase your productivity when editing images is to automate some of the repetitive tasks. Often tasks such as lens correction and color correction need to be done on a series of photos.

For example, a set of photos taken with the same lens at a wedding dinner may all need a lens correction filter applied as well as a color correction to adjust for the lighting at the event. It takes lots of time to make those adjustments to each image individually.

Photoshop has a couple of great utilities that help you automate the workflow necessary to make the same adjustments to a series of photos with one simple command. Batch and Droplets allow you to quickly apply custom actions to files to save time when editing.

Note

Creating custom actions is covered in Chapter 5. You can refer to that chapter for information necessary to build the actions and action sets that can be utilized by the Batch and Droplet processing tools.

Batch processing multiple images

The Batch processing utility allows you to apply a customizable action to a set of images and control how the images are processed.

The way batch processing works is you define a location for a set of files, then select one of the customized actions defined in the Actions panel, and then define how you want the processed photos to be outputted. When the batch is processed each image is opened by Photoshop, the steps in the selected action are performed on the image, and the adjusted image is saved to disk where you can then perform individualized adjustments later.

Batch processes can be started in a couple of different ways: You can select the files in Bridge and then select Tools

Batch processing multiple images

Note

Bridge is discussed in more detail in Chapter 6. Bridge is a great way to organize and manage your images. Using Photoshop's Batch utility is usually the best way to perform batch editing on images.

These options are available in the Batch processing utility:

  • Play: This allows you to define what action to perform on each of the files specified by the sources settings by selecting from the following options:

    • Set: This provides a drop-down list of the defined sets in Photoshop. The default set provides some standard edition actions such as Vignette and Custom RGB to Grayscale. However, you likely will be creating your own action sets with customizable actions. For example, you may want to create an action set with lens correction filter actions for each of your lenses.

    • Action: This defines the action to be performed on each image when the files are processed. Actions can perform anything from a simple one-step edit to a series of several complex edits. The options available from the Action menu represent the list of actions that are contained in the selected Set in the Actions panel.

      Using the Batch dialog box, you can define a custom action that is applied to a set of source files and define a location and file-naming format to save the edited image.

      Figure 31.1. Using the Batch dialog box, you can define a custom action that is applied to a set of source files and define a location and file-naming format to save the edited image.

    • Source: This allows you to define where Photoshop gets the source images to be edited. You can select files from four different sources: Folder, Import, Opened Files, and Bridge.

      When you select Folder, you can use the Choose button to launch a dialog box that allows you to select a folder that contains files to be included in the batch edit.

      Selecting Import allows you to process images from a digital camera, scanner, or PDF. The Import option is available only if you specify that you want to batch process folders when you are importing them into Photoshop or Bridge.

      Selecting Opened Files batch processes all images currently open in Photoshop.

      Selecting the Bridge option batch processes the files currently selected in Bridge. The Bridge option is available only when you are using the Bridge interface to launch the Batch processing utility.

    The Source option also allows you to use the following settings to control the behavior of handling image files from the source location:

    • Override Action "Open" Commands: When this option is selected, batch processing overrides the choice of files specified for an "Open" command in the action. This does not override the settings in the Open command, just the choice of files.

      This option is necessary for actions that include open commands for most recent or current files because the most recent file is always the first image in the set of source files. You should not enable this option for actions that do not contain an Open command.

      You can leave this option disabled if the action does not include an Open command or if the Open command is on another file that is required for the action but not the actual file that is being edited.

    • Include All Subfolders: When this option is selected, images in all subfolders in the selected folder also are batch processed. This allows you to process images in multiple folders so you can keep your files well organized.

    • Suppress File Open Options Dialogs: When selected, this option hides the File Open dialog boxes. Instead of requiring you to specify the open options, the default values are used. This option is especially useful if you are batch processing the camera raw images because you can preset how to treat the images and bypass the dialog box when batch editing.

    • Suppress Color Profile Warnings: When selected, the color policy messages, such as color mismatch or missing color profiles, are not displayed.

  • Destination: This allows you to control how and where the edited images are saved to disk. You can specify one of three different destinations: None, Save and Close, and Folder.

    If you select None, the images are edited but left open in Photoshop unless the action includes a Save or Save As command. If you select Save and Close, the original image is overwritten by the edited image on disk.

    If you select Folder, you can use the Choose button to select a destination folder to save the edited images. The edited images are saved in that location using the name formatting specified in the File Naming setting.

    The following options allow you to override the Save As command and define the file naming convention:

    Warning

    You should select the Save and Close option only if you are confident that the action will result in the best look. After the original file is overwritten, you cannot go back and undo the edits.

    • Override Action "Save As" Commands: When this option is selected, batch processing overrides the destination folder and name of files specified by a Save or Save As command in the action. This does not override the settings in the Save commands, just the destination and name of the files.

      You do not need to enable this option for actions that do not contain a Save or Save As command.

      Note

      Lots of options are available in the Save As command in Photoshop that are not available from the Batch dialog box—for example, compression, saving layers, and so on. Typically, you want to record a Save As command into the editing that sets these options. Also, you can use a Save As command in the action to change the file type of the images during the batch process.

    • File Naming: The file-naming option allows you to set the naming convention that is used to save the edited file. The file convention is defined by selecting the appropriate components from the drop-down menu shown in Figure 31.2. You also can type into one of the field components static text that is included in the filename.

      When the edited file is saved, these components are used in the order specified to create the filename. When you use the components, include the document name and extension in different casing formats, serial letters, multi-digit numbers, and different date formats.

      Note

      When using Digit Serial Numbers, the numbers start with the number specified in the Starting serial# field and are prefixed by enough zeros to force them to the number of specified digits. When using serial letters, the first image starts with a/A.

    • Compatibility: The Windows, Mac OS, and Unix options allow you to limit the naming conventions to support Windows, Apple, and Linux/Unix systems. This is useful if you plan on sharing your images with others who may be using different systems.

  • Errors: This allows you to control how errors in the batch processing are handled. You have two options:

    • Stop For Errors: When this option is selected and an error occurs when editing one of the files in the batch, an error message is displayed and the processing stops there. No additional files are processed.

    • Log Errors To File: When this option is selected and an error occurs when editing one of the files in the batch, the error message is logged to a file and the processing continues. The location of the log file is set by clicking the Save As button. The log file is in text and can be read with any text editor to determine which files failed and why.

The File Naming options in the Batch dialog box allow you to select filename components based on date, document name, extension, and serialized letters or numbers.

Figure 31.2. The File Naming options in the Batch dialog box allow you to select filename components based on date, document name, extension, and serialized letters or numbers.

Creating droplets to process images

Droplets are very similar to Batch operations with the exception that instead of selecting a source for files, you specify a location of where to save the processing info in the file system. The processing data is converted to an executable that processes any files or folders that are dragged and dropped onto it.

Droplets can be created by selecting File

Creating droplets to process images
Using the Create Droplet dialog box, you can create an executable file that applies an action to any image files that are dragged and dropped onto it.

Figure 31.3. Using the Create Droplet dialog box, you can create an executable file that applies an action to any image files that are dragged and dropped onto it.

To create the droplet, fill in the Save Droplet In, Play, Destination, and Errors settings and click OK. An executable file is created in the location specified. To use a droplet, simply use the file system interface to drag and drop files or folders onto the droplet. The droplet uses Photoshop to perform the specified action and save the adjusted files.

Tip

Droplets are compatible to move between Windows and Mac systems. When moving a droplet from Windows to Mac or vice versa, drag and drop it onto the Photoshop executable on the new system. Photoshop converts the droplet to be used on that system. If you are planning to move a droplet from Mac to Windows, make sure to name it with the ".exe" extension so it can be executed on the Windows system.

You should be aware, however, that file references in actions do not work across Windows and Mac systems. If an action refers to a file, such as in an "Open" or "Save As" command, the droplet prompts for the location of the file if it is used on a different system.

Using Scripting to Speed Up Workflow

Another great way to save time and increase your productivity when editing images is to utilize the scripting capabilities in Photoshop. Two main types of scripts are available in Photoshop: the predefined scripts and the event-driven scripts. Predefined scripts are run once by selecting them from the File

Using Scripting to Speed Up Workflow
The File Scripts menu in Photoshop provides several predefined scripts that perform tasks that speed up your workflow.

Figure 31.4. The File

The File Scripts menu in Photoshop provides several predefined scripts that perform tasks that speed up your workflow.
Scripts menu in Photoshop provides several predefined scripts that perform tasks that speed up your workflow.

Using Photoshop's scripts

Predefined scripts are similar to other commands in Photoshop with the exception that they typically perform more than just one task on a single item. The predefined scripts are JavaScript or AppleScript scripts that perform a series of Photoshop tasks to reduce the number of keystrokes and mouse clicks you need to make. The following is a list that describes the predefined scripts available from the File

Using Photoshop's scripts
  • Image Processor: Launches a dialog box that allows you to process a set of files including converting format, changing names, and running actions.

    Note

    The best place to use the Image Processor is from Bridge while you are managing your files. Using the Image Processor utility from Bridge is covered in Chapter 6. You can refer to that chapter for information necessary to use the Image Processor utility to convert and process images.

  • Delete All Empty Layers: Removes empty layers from the image. This can be a useful tool to clean up an image when you have used lots of layers when editing.

  • Flatten All Layer Effects: Flattens all the effects that apply to the currently selected layer in the Layer panel. This rasterizes all the layer effects so you can apply additional filters or other tools that require the layer to be flattened.

  • Flatten All Masks: Applies the layer masks in all layers. The layer masks affect only the layer to which they are linked.

  • Simplify Layers for FXG: Simplifies layer settings so that they are compatible with Adobe's FXG file format. FXG is an XML-based file format that is used in graphics for Web applications which are created by applications such as Adobe Flash or Flex 4.

  • Layer Comps to Files: Opens a dialog box, similar to the one in Figure 31.5, that allows you to specify a file type and location using the following options:

    The Layer Comps to Files script utility can be used to convert the Layer Comps in the current document into individual files.

    Figure 31.5. The Layer Comps to Files script utility can be used to convert the Layer Comps in the current document into individual files.

  • Destination: Specifies the location on disk to create the files.

  • File Name Prefix: Specifies the name prefix that is applied to the saved files. The rest of the filename includes a numerical index and the file extension specified in the File Type option.

  • Selected Layer Comps Only: Allows only the currently selected Layer Comps in the image to be saved as individual image files in the specified location. Otherwise, all Layer Comps are saved as individual files.

  • File Type: Specifies the file format to use when saving the image. You can select BMP, JPEG, PDF, PSD, Targa, TIFF, PNG-8, or PNG-24.

  • Include ICC Profile: Specifies whether to include the current ICC color profile with the saved images. It is always a good idea to include a color profile when saving images.

  • Layer Comps to WPG: Converts the Layer Comps in the image into individual WPG files.

  • Export Layers to Files: Opens a dialog box, similar to the one in Figure 31.5, except that instead of only saving Layer Comps, all layers are saved to files.

  • Script Events Manager: Allows you to attach specific actions to workflow events in Photoshop. The Script Events Manager is discussed in much more detail in the next section.

  • Load Files into Stack: Opens the Load Layers dialog box, shown in Figure 31.6, that allows you to combine a set of files into a stack. A stack is a set of image files taken of the same subject from the same camera position. Image stacks loaded as layers can be converted to Smart object and then processed using the options located in the Layers

    The Layer Comps to Files script utility can be used to convert the Layer Comps in the current document into individual files.
    The Load Files into Stack script utility provides a simple dialog box that allows you to select files and define how the individual files are added to a newly created stacked document.

    Figure 31.6. The Load Files into Stack script utility provides a simple dialog box that allows you to select files and define how the individual files are added to a newly created stacked document.

From the Load Layers dialog box, you can configure the following options:

  • Use: This allows you to specify whether to use files or a folder as the source for the set of files. The Browse, Remove, and Add Open Files buttons allow you to add files and remove files and folders from the Use list.

  • Attempt to Automatically Align Source Images: When this option is selected, Photoshop tries to find common edges in the images and automatically adjusts the rotation and position so the images are as closely aligned as possible. Aligning the images is important for the stack mode algorithms to work well.

  • Create Smart Object after Loading Layers: The stack mode algorithms are based on processing a smart object. Selecting this option automatically creates a smart object from all the images. If this option is not selected, the images are loaded as individual layers that you can edit before combining them into a smart object.

    Note

    Another great place to create image stacks is from Bridge while you are managing your files. Using the Bridge application to stack images is covered in Chapter 6. You can refer to that chapter for information necessary to stack and unstack images.

  • Load Multiple DICOM Files: This opens a dialog box that allows you to select a folder containing a set of DICOM image files. The DICOM files in the folder are added as individual layers to a new document in Photoshop.

  • Statistics: This opens the Image Statistics dialog box, shown in Figure 31.7. This dialog box is similar to the Load Files into Stack option, except that it automatically converts the images into a single smart object and then applies the stack mode specified in the Choose Stack Mode option. Statistics is a better option than Load Files into Stack if you do not want to align the images manually, or if you don't want to edit any of the layers before applying the stack mode to the set.

Using stack modes on multiple images to analyze images and reduce noise

Photoshop provides several options for processing images that have been stacked into a smart object using the Load Files into Stack script described in the previous section. These stack modes options can analyze the differences between images and combine images to reduce noise. The following stack mode options can be found in the Layers

Using stack modes on multiple images to analyze images and reduce noise
  • Entropy: Calculated based on the number of bits that would be necessary to encode the data from all images in a set. Areas of the image that are different show up white in the resulting image, and areas with little difference show up as black. This is a great option for locating missing items between one image and another or embedding hidden copyright notices.

    Figure 31.8 shows an example of using the Entropy stack mode to analyze two digital images. Notice that they both look exactly the same, but when the Entropy mode is employed a clear copyright notice is shown. The copyright notice was added by creating text selection mask, as discussed in Chapter 18, copying it to a new layer and then slightly adjusting the position. You can't see the change because it is in a busy area of the image.

    The Image Statistics dialog box allows you to set the stack mode that is applied after some files are automatically converted into a single smart object.

    Figure 31.7. The Image Statistics dialog box allows you to set the stack mode that is applied after some files are automatically converted into a single smart object.

    Using the Entropy mode, you can quickly compare a digital image with the original to reveal an embedded copyright message.

    Figure 31.8. Using the Entropy mode, you can quickly compare a digital image with the original to reveal an embedded copyright message.

  • Kurtosis: Calculates the stacked image based on peakedness or flatness of the levels in the image. Areas that match a normal distribution of levels appear lighter while areas that are flat or overpeaked appear as darker.

  • Maximum: Uses the maximum channel value for all non-transparent pixels in the stacked image. This is good for stacks of images where you want to lighten the overall image.

    Tip

    For the best results, images that you intend to edit using the stack mode options should be taken from a fixed position such as a tripod with a stationary subject. At the very least, the images must be similar enough that you can align them together in the set.

  • Mean: Averages the pixels for all images in the stack and uses the average value for the stacked image. This is usually the best option for noise reduction if the images are very similar.

  • Median: Takes the middle value for all images in the stack and uses that value for the stacked image. This option works better than mean for noise reduction if there is a lot of variance in the lighting and color of the images, such as scratches or dark areas.

    Figure 31.9 shows an example of how the median mode can be used to remove unwanted items. Notice that the three images of the moon have a silhouette of a bird in front, so none of them are a clean shot. The bird can be removed by stacking the three images and applying the median mode as shown in the results.

  • Minimum: Uses the minimum channel value for all non-transparent pixels in the stacked image. This is good for stacks of images where you want to darken the overall image.

  • Range: Calculates the pixel value in the stacked image based on the maximum pixel value minus the minimum pixel value. This shows the range of variance in the stacked images.

    Using the Median mode, three images of the moon with a silhouette in front can be processed into a single clean image.

    Figure 31.9. Using the Median mode, three images of the moon with a silhouette in front can be processed into a single clean image.

  • Skewness: Calculates the pixel value based on the variance of the pixels away from the average. This shows how close the pixel values are to each other.

  • Standard Deviation: Calculates the stacked image values based on the standard deviation from the mean or square root of the variance. This can help you analyze areas of the images that are different because the areas that are different show up as a lighter value based on the amount of variance while areas that are the same across all stacked images are black.

  • Summation: Calculates the pixel values in the stacked image by adding values from all images in the stack. This increases the resolution in fainter areas of the images, but the brighter areas just become white.

  • Variance: Similar to the Standard deviation. Areas that match are black, and areas that do not match are gray to white based on the variance in the stacked image.

Use the following steps to apply a stack mode to a series of photographs:

  1. Select File

    Using the Median mode, three images of the moon with a silhouette in front can be processed into a single clean image.
  2. Add the files you want to apply to the stack as described earlier.

  3. Select the Attempt to Automatically Align Source Images option.

    This option tries to align the images so that they match up correctly.

    Note

    You may need to manually align the images in the smart object if the auto alignment option fails to align them completely. To align the images manually, double-click the smart object layer to open the smart object. The images are in separate layers, and you can use the Move tool to move the image in each layer until they are aligned.

  4. Select the Create Smart Layer after Loading Layers option. This converts the image layers into a single smart object.

  5. Click the OK button and the images are processed into a single document in Photoshop with a smart object layer.

  6. Select the newly created smart object layer.

  7. Use the Layers

    Using the Median mode, three images of the moon with a silhouette in front can be processed into a single clean image.

    The resulting image in the document window is changed to the results of the stack mode.

Scripting workflow events

Photoshop provides the Script Events Manager, shown in Figure 31.10, that gives you access to certain program events that occur during normal editing workflow. The Script Events Manager lets you attach scripts or actions to these events so that each time an event occurs during your editing workflow, the action/script is run.

Scripting workflow events can be a big timesaver by automatically performing actions you want to happen without needing to remember them. For example, you can configure the open file event to automatically save a JPEG copy so that each time you start editing a file, you have a JPEG backup.

The Script Events Manager utility is loaded by selecting File

Scripting workflow events
  • Enable Events to Run Scripts/Actions: When this option is selected, the associations in the scripted events list are active when you are working in Photoshop. When this option is deselected, the events are ignored and no action or script is run.

  • Scripted Events List: This lists the current associations between events and actions/scripts. The Add button adds the association defined by the Photoshop Event, Script, and Action settings to this list. The Remove and Remove All buttons are used to remove associations from the list.

  • Photoshop Event: This displays a set of Photoshop events that you will encounter during the normal workflow including Start Application, New Document, Open Document, Save Document, Close Document, Print Document, Export Document, and Everything (all available events).

  • Script: This specifies a script that should be associated with an event and should be run each time the event occurs. The drop-down list displays the available scripts. The default script options are fairly limited; however, the drop-down list also provides a browse option so you can select a JavaScript or AppleScript from the file system.

  • Action: This specifies an action that should be associated with an event and should be run each time the event occurs. The first drop-down list allows you to select the action set from the available action sets defined in the Actions panel. The second drop-down list allows you to select the action from the available actions defined in the Actions panel. Because you can easily create custom actions using the Actions panel, you have lots of options when associating actions with events.

Note

Creating custom actions is covered in Chapter 5. You can refer to that chapter for information necessary to build the actions and action sets that can be associated with workflow events.

The Script Events Manager allows you to associate an action or a script to normal workflow events so that each time an event occurs, the action is performed or the script is run.

Figure 31.10. The Script Events Manager allows you to associate an action or a script to normal workflow events so that each time an event occurs, the action is performed or the script is run.

Tip

For the best results, images that you intend to edit using the Stack Mode options should be taken from a fixed position such as a tripod with a stationary subject. At the very least, the images need to be similar enough that you can align them together in the set.

Summary

This chapter discussed utilizing Photoshop's automation and scripting tools to make things easier and speed up image editing. Photoshop provides the Batch and Droplet tools that allow you to perform the same set of commands on a set of files without opening each file individually.

Photoshop also provides several scripts that apply a set of repetitive operations, such as flattening layer masks using a single menu option. In addition to the scripts, Photoshop provides the Script Events Manager that allows you to associate actions and scripts to normal workflow events. Each time an event occurs during your workflow, the associated action is performed.

In this chapter, you learned the following:

  • How to use custom actions to process a set of image files all at once.

  • When you create a droplet, Photoshop performs a predefined action on each file that is dragged and dropped onto it.

  • Photoshop provides several scripts that allow you to perform repetitive actions.

  • Using the Statistics scripts, you can load a series of photos into a stack and then automatically process the set of files to clean up noise in a way that is not possible with a single file.

  • Normal workflow events such as opening or saving a file can be tied to actions such that the action is automatically applied when the event occurs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset