Images Before and After

JavaScript for Adobe Photoshop
Latest update 3/8/2019

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 current image open in Photoshop. The reference to original content may be a folder of images, or may draw from the lowest layer of corrected images, minus adjustment layers above it.

  • Compare corrections to original, side-by-side
  • Compare to original or lowest layer of correction
  • Process current 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 three sections: Original images, Corrected images, and Output. Enable desired options and click the OK button to begin. A progress bar is displayed while processing. To cancel processing, press the ESC key. Otherwise, when complete, the number of images processed is reported. If any concerns are encountered, a log file is written to the corrected images folder and the user is notified.

Section 1: Original images

Lowest layer of corrected images — the “before” (original version of image) is drawn from the lowest layer of the corrected image. Lowest layer is defined as a layer containing imagery (pixel data), not a group or adjustment layer. 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/or 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, avoid this option and instead use the Folder option below.

Folder — the “before” content is drawn from a folder containing original versions of the corrected images. Click the button to select the desired location. For each corrected image, the specified folder is searched for a file that matches based on the choice in section 3, Match file names, ignoring extension.

Section 2: Corrected images

Current image — processes the active image, defined as the image currently open and the top-most window if multiple images are open.

Folder — processes a folder of corrected images. PSD, and TIF are recognized. All other file extensions are ignored. Click the button to select the desired location. If no matching files are found, the user is notified.

Section 3: Match file names, ignoring extension

When the choice in section 1, Original images is a folder, the choice here determines how corrected images are matched to original images. For each corrected 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 original image is found, an alert is logged and a comparison image is not produced.

Exact — the corrected and original image base names match precisely.

Contains original name — the corrected image base name contains the original image base name. Use when a suffix or other modification is made to corrected image file names. For example, corrected image “IMG_2345_edit.psd” will match original image “IMG_2345.jpg”.

Contains corrected name — the original image base name contains the corrected image base name. Use when a suffix or other modification is made to original image file names. For example, corrected image “IMG_2345.psd” will match original image “IMG_2345_orig.jpg”.

Section 4: Output

Folder — the location to which comparison images are saved. If not already defined, the folder is set when selecting options in the section Corrected images. If processing the Current image, the folder is set to the location of the current image. If processing a folder of corrected images, the folder is set to Comparison images, a subfolder within the folder of corrected images. To override either default, click the button and select or create the desired location.

Original 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.

Simulate profile — before combination with the original, the corrected image is converted to the specified profile and then to sRGB for the comparison image. This step makes evident any color shifts introduced by conversion to the project’s ultimate output 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 the 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 original and corrected 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 image to make room for the labels. Without labels, know the left-hand image is original and the right-hand image is corrected.

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 output options are preserved, and the next time the script is launched, output options are restored to the last values used. This does not include folder locations or the choice to draw original content from the lowest layer of corrected images. These choices are made 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 19.3.8

  1. Add license.

Version 19.2.24

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

Version 19.2.21

  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. Force foreground/background colors to black/white.
  2. Miscellaneous.

Version 19.1.15

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

Version 19.1.5

  1. Initial release.