Images Before and After

JavaScript for Adobe Photoshop
Latest update 9/21/2019, version 2.3

The script creates side-by-side comparison images to show before and after editing. Comparison images are output to JPEG that can be sent to clients for approval. In batch mode the script processes a folder of images, or the user may choose to process the active image open in Photoshop. In either case, there are three ways to reference before images: 1. a folder of original images; 2. the lowest layer of after images; or 3. after images without the highest group.

  • Compare corrections to original, side-by-side
  • Three options to reference before images
  • Process active image or folder of images
  • Simulate a color profile
  • Set PPI
  • Limit pixels in either dimension
  • Specify labels to indicate before and after
Images Before and After screen
Download
Images Before and After

You decide. Reward the author an
amount the solution is worth to you.

Example output of Images Before and After script

Instructions for use

The interface has four sections: Before, After, Match file names, and Output. Enable desired options and click the OK button to begin. If processing the active image, any errors or concerns are reported immediately. If processing a folder, a progress bar is displayed. To cancel processing, press the ESC key. Otherwise, when complete, the number of images processed is reported. If any errors or concerns are encountered, a log file is written to the after images folder and the user is notified.

Section 1: Before

'After' image lowest layer — the before image is created from the lowest layer of the after image. Lowest layer is defined as a layer containing imagery (pixel data), not a group or adjustment layer, and without regard for its current visibility (if hidden it is made visible). Whether the lowest layer is Background (typical) or is a layer nested inside a group, the layer is forced to the bottom, and all layers and groups above the layer are removed. For most color correction scenarios, this results in the equivalent of the unaltered original image. For situations in which the lowest layer is not equivalent to the original, use one of the other options to reference before images.

'After' image without highest group — the before image is created by duplicating the after image and then removing the highest layer group. This option is for workflows that add a group of adjustment and other layers to the image each correction round. Removing the highest group then represents the last edit of the image (or original if the first round of corrections). If the image layer structure does not lend itself to this approach, use one of the other options to reference before images.

Folder — the before images are loaded from a folder of original images. Click the button to select the desired location. For each after image, the specified folder is searched for a file that matches based on the choice in section 3, Match file names, ignoring extension.

Important note: If creating comparison images using a folder of before images, the images must match the dimensions of the after images. Any images that differ in dimensions may produce unpredictable results. If alterations to the images since original includes cropping or resizing, use one of the other options to reference before images.

Section 2: After

Active image — processes the image that is currently open and the top-most window if multiple images are open.

Folder — processes a folder of after images. PSD and TIF are recognized. Other file extensions are ignored considering that after images are assumed to be retouch corrections likely using adjustment and other layers, unsupported by formats other than PSD or TIF. Click the button to select the desired location. If no PSD or TIF files are found, the user is notified.

Section 3: Match file names, ignoring extension

When the choice in section 1, Before, is a folder, this choice determines how after images are matched to before images. For each after image, the specified folder is searched for a file that matches the base name (file name less extension) of the image. For example, if original files were submitted as .jpg, but working files are saved as .psd, images match regardless of the difference in file extension. If no matching before image is found, an alert is logged and a comparison image is not produced.

Exact — the before and after image base names match precisely.

Contains 'before' image name — the after image base name contains the before image base name. Use when a suffix or other alteration is made to after image file names. For example, after image “IMG_2345_edit.psd” matches before image “IMG_2345.jpg”.

Contains 'after' image name — the before image base name contains the after image base name. Use when a suffix or other alteration is made to before image file names. For example, after image “IMG_2345.psd” matches before image “IMG_2345_orig.jpg”.

Section 4: Output

Folder — the location to which comparison images are saved. The script sets the folder when selecting options in section 2, After. If processing the Active image, the output folder is set to the location of the active image. If processing a folder of after images, the output folder is set to the folder of after images. To override either default, click the button and select the desired location.

'After' file name + — a suffix of characters appended to each comparison image file name. The characters entered must be legal to use in file names. Illegal characters detected are changed to a dash. A suffix is required to prevent overwriting files and may not be set blank.

Simulate profile — the comparison image is converted to the specified profile and then to sRGB. This step makes evident any color shifts introduced by conversion to the project’s destination profile.

Set PPI — changes the pixels per inch of the comparison image. The option does not resample the image; it only sets the resolution. Use the next option, Maximum pixels, to alter comparison image size.

Maximum pixels, width and height — limits the final pixel dimensions of the comparison image. Enter a value in pixels for the width and/or height. It is acceptable to omit one of the dimensions. In that case, the entered dimension is limited and the other falls wherever it may. When both values are entered, neither dimension exceeds the value entered. One dimension may result in fewer pixels than entered if necessary to maintain proportions. In other words, setting both values does not define precise width and height; it only defines the upper limit of each dimension.

Add labels — inserts descriptive labels below the before and after images to make clear which is which. Enable the checkbox and enter desired label text. When enabled, a blank area is added to the bottom of the comparison image to make room for the labels. Without labels, know the left-hand image is before and the right-hand image is after.

Embed sRGB profile — embeds the color profile into comparison images.

JPEG quality — valid range is from 0 to 12. 0 is extreme compression resulting in low quality. 12 is light compression that is virtually indistinguishable from the original, the highest possible quality, which of course, results in the largest file size.

Other notes

Because comparison images are output as JPEG, some image modes are converted or not allowed. Multichannel mode is not compatible, and if encountered, an alert is logged and a comparison image is not produced. Bitmap, grayscale, and duotone modes are converted to RGB for comparison images. When these image modes are encountered, additional processing is automatic and no alerts are logged. If an image contains spot color channels, the channels are merged into the RGB portion to replicate the appearance of the image with the spot colors, and an alert is logged.

When comparison images are output, any existing comparison images of the same name are replaced without alert.

Each time processing begins, the current options are preserved, and the next time the script is launched, options are restored to the last values used. This does not include folder locations, which are selected each time the script is launched.

Output to PDF. To create a PDF of comparison images combined into a single document, use the Acrobat feature Create -> Combine Files into a Single PDF (File menu). Add the comparison images, combine, and then save the resulting PDF.

Available color profiles. For the option Simulate profile, the list of profiles from which to choose is compiled by searching known locations in the system for .icc/.icm files and extracting the profile name. This occurs each time the script is launched. The list should include most of the same profiles Photoshop displays in dialogs such as Color Settings, but it doesn’t match exactly. If a needed profile does not appear in the list, add the profile to a location both Photoshop and the script look for profiles (below) and relaunch the script.

macOS

:Library:ColorSync:Profiles

Windows

\Windows\System32\spool\drivers\color

Download
Images Before and After

License details included in download

For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.

IMPORTANT: by downloading the script you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.

CHANGE LOG

Version 2.3 (190911)

  1. UI verbiage change for consistency, 'active' in place of 'current'.

Version 2.2.1 (190911)

  1. Update progress window in message function.

Version 2.2 (190902)

  1. Miscellaneous.

Version 2.1.1 (190624)

  1. Miscellaneous.

Version 2.1 (190510)

  1. Revise logging.
  2. Revise settings.
  3. Revise notify window.
  4. Better handle user cancel.
  5. Miscellaneous.

Version 2.0 (190430)

  1. Revise logging.
  2. Custom alert/notify window.
  3. Revise UI wording for better clarity.
  4. Add option to use 'after' image without highest group.
  5. Restore app preferences on completion.
  6. Miscellaneous.

Version 19.4.12 (1.1.5)

  1. Recognize never saved images and disallow current image option.
  2. Inexplicable error with one particular image. Added try/catch to resolve.

Version 19.3.8 (1.1.4)

  1. Add license.

Version 19.2.24 (1.1.3)

  1. Update settings file error handling.
  2. Miscellaneous.

Version 19.2.21 (1.1.2)

  1. Max pixels scale both width and height (prior width only).
  2. Fix logged file name undefined (document lacks fsName property).

Version 19.2.17 (1.1.1)

  1. Force foreground/background colors to black/white.
  2. Miscellaneous.

Version 19.1.15 (1.1)

  1. Add options to match file names exactly or if contains portion of name.

Version 19.1.5 (1.0)

  1. Initial release.