PRESERVING HISTORY

How to Digitally Archive and Share Historical Photographs, Documents, and Audio Recordings

Appendix E. Batch Processing of Images

Batch processing is very useful when a large number of files require the same processing. For example, using a camera to digitize a diary can easily generate hundreds of images that need to be rotated and renamed. Batch processing allows the changes to be applied to a group of files.

The main steps that may need to be done with batch processing for historical images are listed below in the order they would typically be applied.

·        Rotate the image

·        Crop the image

·        Adjust tone and color

·        Set the resolution (ppi) to determine the size of the output image

·        Assign or convert color space for the image

·        Set the format of the output file

·        Rename the file

Batch processing begins by identifying the changes that need to be made for a group of images. Typically, the changes are made to one of the files and the steps or settings recorded. Then these changes are specified for batch processing and applied to the other files. Output file names typically have characters identifying the group of files and then a number that is incremented for each file in sequence (e.g., dmb_diary_1926_001, dmb_diary_1926_002).

The safest strategy for batch processing is to put the output files in a separate folder from the input files. The input files should not be deleted until the batch processing has been verified to have completed successfully. While batch processing can greatly speed processing, it can also cause extensive damage if there are problems. With separate input and output folders batch processing can easily and reliably be redone if there are problems.

As would be expected, Photoshop CS has powerful batch processing capabilities. Photoshop Elements has limited batch processing capabilities that primarily can convert the format and apply auto adjustments to a group of files, but does not have a way to rotate the images or make custom adjustments. The free XnView image-viewing application has useful batch processing capabilities but is limited to processing with only 8 bits per channel. XnView used alone or along with Photoshop Elements is usually adequate for processing simple documents such as diaries.

The free IrfanView image-viewing program has very useful options for renaming files and for lossless rotation, lossless cropping, and lossless setting of ppi for JPEG files. These lossless operations are done without recompressing and thus slightly degrading the images. At present, Photoshop CS and Photoshop Elements do not have lossless operations for JPEG files.

It is highly recommended that each image is checked to make sure the result of the batch processing was as expected. These checks can be done quickly with image-viewing software such as XnView or the Windows Photo Viewer.

E.1 Batch Processing with XnView

The free image-viewing program XnView (Gougelet, 2012) has surprisingly powerful batch processing capabilities. The primary limitation is that an input file with 16 bits per channel is first converted to 8 bits per channel and then processed with 8 bits per channel. The output color space and embedded profile can be set with batch processing. However, saving files outside of batch processing should be avoided. If adjustments are made to an image outside of batch processing, the working color space and embedded profile are for the monitor profile rather than a standard working color space. This description is for XnView version 1.98.7.

XnView opens with a file browser that can be used to select a file for viewing. Double-click a file or thumbnail image to open the file for viewing. The right and left arrow icons or the spacebar and backspace key can be used to view the next or previous file in sequence. The mouse scroll wheel zooms the image.

A color profile for the monitor can be used when viewing images with XnView. The profile is set using the dropdown menu Tools> Options. Then click the General row in the left column and click the ICC tab. Click the checkbox for “Use ICC embedded profile (JPG/TIFF) – very slow)” and enter the name of the profile file for the monitor. The location of the system profiles is provided in Appendix A. The settings for “Default ICC profile” specify a working color space to use when an input file does not have an embedded profile.

Batch processing is started in XnView by tapping Ctrl-U or with the dropdown menu Tools> Batch Processing. With this option the output files are given the same name as the input files. Another option Tools> Sequence Convert is intended for situations when the input and output file names contain sequential numeric values. However, Sequence Convert halts with an error message if any glitch occurs in the input file names, including a missing number in sequence. I seldom have the needed consistency for input file names and find Tools> Batch Processing more useful.

On the Batch Processing dialog box, click the Add or Add Folder button to select files to be processed. Then select the output directory and output format, which usually will be either TIFF or JPEG. The modifications to the image are set by clicking the Transformations tab, which brings up a dialog box with a list of adjustments on the left. The adjustments are placed in categories and are referred to here as Image: Crop for the Crop adjustment in the Image category. To select an adjustment, click on the adjustment and then click the Add button. Option settings for a particular adjustment appear after the Add button has been clicked. The values for the option settings will usually need to be determined by experimenting with a typical image prior to starting the batch processing step. The adjustments will be applied in the order they are listed by the Add button. The steps for making specific types of adjustments are described below.

Develop Settings for a Typical Image. The first step in batch processing is to open a typical image and develop the adjustment settings needed for the images. The relevant settings should be written down for entering in the batch processing settings. The methods to develop the settings for batch processing adjustments are described with the batch processing options below.

Rotate the image. Image: Rotate is used to rotate an image. Using JPEG for both the input and output image is not recommended, but if that is done, Image: JPEG Lossless rotation would be optimal. I have not experimented with this option for XnView.

Crop the image. Image: Auto Crop or Image: Crop can be used to crop an image. Image: Auto Crop crops based on excluding a specified background color and may be useful in some situations. Image: Crop crops based on the location and size of the cropped area, and has settings that must be determined prior to batch processing. The width and height of the cropped area need to be specified in pixels, along with the X and Y coordinates for the upper left corner. Obtain these values by opening a typical image and using the mouse to drag an appropriate selection area for cropping. Various numbers are written below the image display. On the far right, two numbers in parentheses give the X and Y coordinates for the upper left corner of the selected area. The numbers to the left will include numbers like “- 3030x2500” which indicate the width and height of the selected area. These numbers must be entered into the fields for the batch processing crop settings.

Adjust tone and color. The histogram black and white points are set with Map: Levels. For documents these settings typically would be determined from manual exploration of a typical image using the dropdown menu Image> Adjust> Levels. The mid-tone or gamma adjustment is set with Map: Gamma and the exploration with a typical image is done with Image> Adjust> Brightness/Contrast/Gamma/Balance. The other settings for the Brightness/Contrast/Gamma/Balance dialog box have counterparts on the batch processing Map: category, but should be infrequently needed. Map: Auto Levels might be useful in certain situations and can be explored with Image> Map> Automatic Levels. XnView has a variety of other tone and color adjustment options, but many are not well documented and will probably not be needed for archival work.

Set the resolution to set the size of the output image. For an image from a camera, the size of the output image in inches can be set by specifying the number pixels per inch (ppi) for the output file without changing the number of pixels in the image. As described in Chapter 4 and Appendix D, the size of the original item should be recorded as part of the documentation. An easy way to estimate the needed ppi is to use the mouse to select an area of a typical image for which the size was recorded. For example, select one page. The size of the area in pixels is indicated as described above for cropping. Divide the number of pixels on one side by the length in inches of the side to get the pixels per inch. This is set for batch processing using Image: Set DPI.

Assign or convert color space for the image. Color profiles are handled with Image: ICC convert. If the input file has an embedded profile that will be used by default, unless the checkbox for “Ignore embedded profile” is checked. The field for “Input profile (sRGB by default)”can be used to assign a color profile for input files that do not have one embedded. A similar field is present for output files. The checkbox for “Black point compensation” will usually be checked. Rendering intend can also be selected, although as noted in Appendix A, relative colorimetric will typically be used for working color space even if perceptual is specified here.

An embedded color profile can be removed with Image: Clean Metadata. Check the checkbox for “ICC Profile” to remove an embedded profile.

A color image can be converted to grayscale using Convert: Convert to Greyscale, or a specific color channel can be selected for grayscale conversion using Image: Extract Channel. An embedded color profile is not handled properly with conversion to grayscale. An appropriate embedded profile can be obtained by removing the embedded profile from the image and then assigning a grayscale profile as the default for both input and output under Image: ICC convert.

Other adjustments. Other batch processing adjustments that may sometimes be useful include Filter: Sharpen and Noise: Reduce noise.

Run the batch process. The batch process is run by clicking the Go button on the lower left of the dialog box. The settings for the batch process can be saved and reused with the Script field.

 E.2 Batch Renaming Files and JPEG Lossless Operations with IrfanView

The free image-viewing program IrfanView (Skiljan, 2012) has useful batch processing capabilities for lossless rotation and cropping of JPEG files and for renaming files when sequential numbers are wanted in the file names. IrfanView can also reset the ppi for a JPEG file without re-compressing the file. IrfanView has other batch processing functions, but these are generally not suitable for archival work because the monitor color profile is used for the working color space and is not embedded in the output files.

When a file is renamed with no other processing, the content of the original file is not changed. Similarly, when lossless JPEG operations are performed, the files are not recompressed and degraded.

Renaming Files

Activate the batch processing screen by tapping the B key or using the dropdown menu File> Batch Conversion/Rename. On the upper left check the button for Batch Rename. This allows renaming files but no other changes. Set the “Name pattern” field for the output file names. The key point is that a # symbol provides a digit. Thus the pattern dmb_diary_1926_### provides an output name with the last three characters being 001, 002, etc. In the field for “Output directory for result files” specify the output folder.

The folder with the files to be processed is specified in the “Look in” field. The specific files to be processed need to be listed in the box for “Input files:.” The file names can be moved there with the Add All button or by selecting certain files and clicking the Add button. Make sure the files are in the correct order for processing. The sequential numbers added to the file name are based on this order. The Add buttons do not always keep the files in the order of their file names. The safest strategy is to click the Sort button and sort the files by file name. Other orders can be used and the order can be changed by moving individual file names.

After the input files are selected and ordered, click the Start Batch button. Each file will be listed as it is processed.

Lossless Rotations, Cropping, and Setting ppi for JPEG Files

Lossless rotation, cropping, and setting ppi for JPEG images are done using the “JPG_Transform” plug-in for IrfanView. The plug-in is downloaded and installed as described on the IrfanView website.

For an individual image, lossless rotation is initiated with the dropdown menu Options> JPG Lossless Rotation, or taping Shift-J. This brings up a dialog box that allows the selection of the degree of rotation in units of 90 degrees. The safest practices for long-term archives are to check the checkbox for “Perfect transformations only …” and clear the checkbox for “Optimize JPG file.” When the Start button is clicked, the input file is replaced by the modified file. There is no option to create a different file. This behavior is relatively safe because the image can be rotated back to the original orientation with no loss of quality if a mistake is made.

Lossless rotations should be done before cropping. A rotation is completely lossless only when the image size is an even multiple of the JPEG block size (usually 16 pixels). The images from virtually all digital SLR cameras meet this requirement, but some point and shoot cameras do not. Also, cropped images typically do not meet this requirement. The checkbox for “Perfect transformations only …” will give an error message when a completely lossless rotation cannot be done. For most archival images the loss will not be noticeable if the rotation is done when not perfect. However, the best practice is to avoid this situation by using a good camera and rotating before cropping.

For an individual image, lossless cropping is done by first using the mouse to drag a rectangle on the image to select the area to be cropped. Then click the dropdown menu Options> JPG Lossless Crop, or tap Ctrl-Shift-J to bring up a dialog box. The only choice is whether the output file is put in the same folder with the term “_crop” added to the file name or put in a different folder with the original file name. Because this is an irreversible change to the output file, there is no option to replace the input file. My standard practice is to write the output file to a different folder and then check each file to verify that it is correct. After verification, I use Windows Explorer to replace the original files with the new files.

The lossless rotation dialog box also allows changing the default ppi (dpi) for a JPEG image. This can be used to set the default size of an image. After determining the appropriate ppi to make the image size match the original item, click the check box for Set DPI and enter the ppi in the two fields. The appropriate ppi can be determined by dragging the mouse to create a selection over an area that has a known width or height. The width and height of the selected area in pixels is displayed in the “(Selection …)” section of the title bar at the top of the IrfanView window. The first pair of number is the number of pixels for the location of the upper left corner (width, height) of the selection and the second pair of number is the location of the lower right corner. The ppi is calculated by dividing the number of pixels in the selected length by the number of inches for that length.

For batch operations, the images to be processed are first selecting using the Thumbnails display option for IrfanView. This is initiated with the dropdown menu Files> Thumbnails, or by clicking the Thumbnails icon or taping T. This displays thumbnails of all the image files in the current folder. Select the files to be processed with the usual selection methods of clicking a thumbnail or Ctrl-clicking for multiple items. After selecting the files, right click the mouse and select the option for JPG Lossless Operations to bring up and apply the dialog boxes described above.

E.3 Batch Processing with Photoshop Elements

Batch processing with Photoshop Elements is limited to converting the format and making auto enhancements of images. Very limited resizing and renaming can also be done. Occasionally, these capabilities may be all that are needed for processing of historical images, but the more typical cases will need cropping, rotation, and custom enhancements and resizing. Those adjustments can be made with XnView or IrfanView. The primary function that Photoshop Elements can provide is to write the EXIF color space field in the output file. As noted in Chapter 2 and Appendix A that is best practice but is not absolutely necessary when the file has an embedded profile.Batch processing in Photoshop Elements is started with the dropdown menu Files> Process Multiple Files. The options in the dialog box are straightforward, including the source and destination folders. All files in the source folder are processed. Unfortunately, Photoshop Elements does not provide an option to specify the root of the output file name when names with sequential numbers are used. Also, the image resize option is limited to certain resolutions.

E.4 Batch Processing with Photoshop CS

Batch processing with Photoshop CS is done in two steps. First an Action is created that has the commands for making modifications to an image. This is done by recording the commands as they are applied to a test image. Second, a Batch job runs the Action on specified images and renames the output files.

Creating Actions

Actions are managed with the Action panel that is displayed by clicking the Action icon on the right vertical panel bar, or by tapping Alt-F9, or by clicking the dropdown menu Windows> Actions. The Action panel lists the current Actions. Actions are grouped under Action Sets, which are categories developed by the user. Photoshop CS comes with the default Action Set “Default Actions.”

Actions can be developed, modified, and executed using the icons along the bottom of the panel or by clicking the list icon in the upper right of the panel frame. The use of either the icons on the bottom or the menu of options to initiate these processes is assumed in the discussion below. These icons and menu items have obvious labels and are not described here unless there is potential confusion. For the steps described here the Actions panel should be in edit mode and not button mode. The mode is toggled in the first menu item from the list icon in the upper right of the panel frame. Make sure Button Mode is not checked.

The recommended steps for developing and applying Actions are:

·        Make an Action Set named Temp to hold the Actions created for historical batch processing. These Actions will typically be temporary and used for only one project.

·        Explore and experiment with a test copy of one or more images until a good idea of the specific changes that are needed has been developed. The Action should be created after you have relatively precise ideas about the changes.

·        Open a new test copy of one of the images to be processed.

·        Create a new Action with a name that indicates the purpose of the Action.

·        Turn on recording for the Action.

·        For the test image, complete all the processing steps that are needed. The typical steps are listed earlier in this chapter and each step is described in more detail in Appendix D. Each step or command appears as a row for the action in the Action panel. Note that the Save As command and the output file name are typically used in developing an Action. The output file name specified in the Action will be used when the Action is played on one file, but is overridden when the Action is applied with batch processing.

·        A command in an Action can be flagged to be manually set by clicking the first checkbox to the left of the command name in the list of commands in the Action panel. When the Action plays it will stop at this command and wait for the user to finalize the command. For example, custom cropping for each image could be applied. The Action will display the proposed cropping selection used when the Action was created, but the user can modify it. The Action will continue after the crop has been applied for an image (by double-clicking in the cropped area or tapping Enter).

·        Turn off recording for the Action.

An Action can be applied to a different image by opening the image and then playing the Action.

Actions can be saved and loaded for easily transferring them for use by others or on other computers. An entire Action Set is saved or loaded. Click on the name of an Action Set to make it active. The list icon in the upper right of the Action frame includes options to save and load Actions.

Modifying Actions

Once an Action has been created, several useful methods can be used to modify the Action. These include:

·        The individual commands in the Action can be displayed or collapsed by clicking the triangle immediately to the left of the Action name.

·        The order of the commands can be changed by clicking on a command and then dragging it to a different location.

·        A command can be turned off by clearing the farthest left checkbox on the row with the command.

·        New steps can be entered after a certain command by clicking on the command and then turning on record. The new steps end when recording is turned off.

·        A command can be deleted by clicking on the command and then clicking the trash icon or the delete menu item.

·        A command can be modified by double-clicking on the command. It may be necessary to play the Action on a test image for the settings to display.

·        The commands can be executed one at a time by clicking on the first command (not the Action name) and then clicking play while holding down the Control key. The Action advances one step each time play is clicked with the Control key held down. This may be useful in modifying command settings or testing the Action.

Batch Processing Actions

In batch processing, an Action is applied to all the image files in a folder. Photoshop CS does not provide a way to filter or select certain files in a folder. The image files to be processed should be copied to a folder used for batch processing. A separate folder for the output files should also exist. Temporary folders may be created and used for these purposes.

Batch processing is initiated with the dropdown menu File> Automate> Batch. The dialog box has fields to specify the Action that is to be used, the source folder with the image files to be processed, the destination folder for the image files that are created, and the names of the output files. Generally the checkboxes for “Suppress File Open Options Dialogs” and “Override Action ‘Save As’ Commands” will be checked. The options for creating the output file names are straightforward and include a root term, sequential file identifier, and extension. The option for “extension” must be included as the last part of the file name or an error message will appear.

The Image Processor is an alternative to batch processing that can convert the format of files and run Actions. This is started with the dropdown menu Files> Scripts> Image Processor. The options are similar but more limited than for batch processing.

E.5 Automating Frequently Used Actions with Photoshop CS

Actions can be used to automate steps that are frequently needed. Hotkeys can make this highly efficient. For example, the steps to implement a high pass sharpening layer described in Chapter 5 can be set to execute by tapping a hotkey such as F8. When an image is open, tapping F8 will make a new merged layer, execute the high pass filter, make it a smart filter, and set the blend mode to Overlay. These types of Actions would normally be created and kept in an Action Set that is permanent rather than the temporary Actions described above.

A new merged lay can be created easily when recording an Action by tapping Alt-Ctrl-Shift-N to make a new blank layer, and tapping Alt-Ctrl-Shift-E to make the new layer merge all visible layers. After the merged layer has been created, the high pass filter or other adjustment is executed as usual. The high pass filter step can be made manual by checking the box to the left of the command in the Action. This can be done after the recording of the Action has been stopped. When the manual box is checked, the Action execution will display the high pass filter dialog box and wait for the user to review and modify the settings. The Action will continue when Ok is clicked on the dialog box. The hot key for the Action is selected in the dialog box for setting the name of the Action that comes up as the first step in creating an Action.

An Action and batch processing can also be used to assign or convert color space. For example, the files made with a Nikon Coolscan 5000 scanner using Adobe RGB color space need to be have the Adobe RGB color space assigned in Photoshop in order for color space to be reliably identified. A simple action and batch process can be used to do the assignment on many files at once. Certain folders could be dedicated for this process.

E.6 Automating Frequently Used Actions with Photoshop Elements

Photoshop Elements can run sets of commands stored as Actions but cannot create the Actions. Actions that are created in Photoshop CS can be transferred to Elements and then run within Elements.

However, my experience has been that custom Actions in Photoshop Elements are basically not usable. So many errors, warnings, and glitches occurred that the Actions could not be used reliably.

Information for setting up and using Actions in Photoshop Elements is provided for those who may want to experiment with this option. The Actions are created in Photoshop CS as described above. The Action Set with the Actions for Photoshop Elements is saved as described above. It is best to remove or turn off steps that are not available in Photoshop Elements such as making smart objects. The saved file for the Action Set is then copied to the following folder for Photoshop Elements: C:\ProgramData\Adobe\Photoshop Elements\9.0\Locale\en_us\Workflow Panels\actions. Any action set file in this folder will automatically appear as options within Photoshop Elements.

Actions are run from Photoshop Elements by clicking the Edit tab if it is not already active, then clicking the Guided tab, and then the Action Player button on the Automated Actions panel. The triangle icon on the Automated Actions panel may need to be clicked to display the Action Player button. In the Action Player, select the name of the Action Set that was created in Photoshop CS, then select which Action is wanted, and click the Play Action button. The hot keys do not work in Photoshop Elements.

Resources

Skiljan, Irfan, 2012. “IrfanView.” Accessed July 24, 2011 as http://www.irfanview.com/.

Gougelet, Pierre-emannuel, 2012. “XnView.” Accessed March 1, 2012 at http://www.xnview.com/.

 

 

 [Version of 1/15/2015]


Historical photos and documents

Appendix E. Batch Processing of Images

E.1 Batch Processing with XnView

E.2 Batch Renaming Files and JPEG Lossless Operations with IrfanView

E.3 Batch Processing with Photoshop Elements

E.4 Batch Processing with Photoshop CS

E.5 Automating Frequently Used Actions with Photoshop CS

E.6 Automating Frequently Used Actions with Photoshop Elements

Resources

 Appendix E as PDF

Chapters in the Book

Introduction: Background, Purpose, and Example Archive Projects

1. Basic Principles of Archiving Photographs and Documents

2. Good and Best Practices for Making Digital Images

3. Setting Tone and Color in Master Images

4. Documentation for Historical Images

5. Preparation and Display of Historical Photographs and Documents

6. Good and Best Practices for Making Audio Recordings

7. Preparation and Presentation of Historical Audio Recordings

8. Historical Slide Shows

9. Copyrights and Other Legal Rights

Appendices

A. Practical Color Management

B. Overview of Scanning Software

C. Effective Resolution of Scanners

D. Using Copy Stands with Cameras

E. Batch Processing of Images

Other Resources

Guidance on Using Scanning Software

Guidance on Using Slide Show Software

Downloads and Links

This website and book were developed by Jim Kennedy.

Email: archivehistory@jeksite.org

© 2012, 2013, 2015 James E. Kennedy