Batch Multi Save
Latest update 12/6/2018
The script scans a folder for images, performs selected transformations, and saves copies in up to four common formats. While this functionality is similar to existing scripts (for example, Image Processor, included with Photoshop), Batch Multi Save adds capability missing from other file saving scripts.
- Process all or selected extensions
- Process raster images, PDF, AI, and vector EPS
- PDF first page, all pages, or all images
- Save PSD, TIF, JPG, and PNG 8 or 24
- Convert to any color profile
- Layers as-is, merged, or flatten
- Adjust PPI, set or resample
- Limit pixels in either dimension
- Keep paths, only clipping, or discard all
- JPG and PNG rename for web use
- Save and restore all settings
The original idea was to automate saving final files after color correction/retouching. My working files are PSD with layers and masks, but the client doesn’t need all that. Most want something for print and web — a single layer or flattened CMYK TIF, and RGB JPG/PNG at lower resolution. Other tools accomplish most of this, but not every step in one tool, or with sufficient control. I wanted more. Also useful for web development, the script can down-sample images or extract from PDFs, transform, and save in one operation.
Instructions for use
The interface has four sections: Input, A group of four output formats, Output, and Settings. 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 errors or warnings occur, a log file is written to the input folder and the user is notified.
Section 1: Input
Folder — select a folder to scan for images. If no image files are found, the user is notified.
Include subfolders — if enabled, images in the selected folder and in every folder below it are processed. If disabled, only images in the selected folder are processed.
Any extension — any file Photoshop is able to open is processed. If Photoshop cannot open a file, the error is reported in the log file. The script ignores a list of extensions we know won’t open (i.e. txt, doc, etc.). Because the script won’t even try, these are not reported in the log file.
Only the extension(s) — files matching extensions in the list are processed. Enter a single extension or separate multiple extensions with a space or comma. The preceding dot is not necessary and if present is ignored.
PDF/AI/EPS options — additional options when the script encounters PDF, Illustrator (PDF compatible), or vector EPS. The script recognizes raster EPS and processes normally, not as vector.
PDF panel — the choice to rasterize the First page or All pages, or instead extract all Images from the PDF.
Crop to — the page box used to crop the PDF page or Illustrator art. Does not apply to vector EPS, which always crop to the bounding box.
Resolution — pixels per inch used to rasterize the PDF page, Illustrator art, or vector EPS. Does not apply to PDF images, which maintain their original resolution.
Mode — the color space used to rasterize the PDF page, Illustrator art, or vector EPS. Does not apply to PDF images, which maintain their original color space. When vector files are rasterized, the color profile used is determined by the application Color Settings, just as when opening vector files directly in Photoshop. Set the desired color profiles using the menu Edit -> Color Settings before launching the script.
Section 2: Group of four output formats
The script outputs images in the formats PSD, TIF, JPG, and PNG. To enable output of a format, click its checkbox Save in folder. Options available vary between formats as described below.
Options common to all output formats
Save in folder — enable the checkbox to save a version of each image in the selected format, then enter a folder name in which the copies are saved (required).
Adjust PPI to —enable the checkbox and enter the desired pixels-per-inch value.
Set/Resample — determines how Photoshop arrives at the entered PPI value. Set does not change the number of pixels, only records how many make up an inch. Resample maintains the current image dimensions (in inches) and increases or decreases the number of pixels to arrive at the entered PPI value. Note Resample method is Automatic.
Maximum pixels, width and height — enable the checkbox to limit the final pixel dimensions of the image, and 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 less 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.
IMPORTANT NOTE: if the Maximum pixels option is enabled and Adjust PPI to is also enabled, it is usually best to select Set rather than Resample because PPI is adjusted before evaluating maximum pixels. When PPI is resampled to a low value (i.e. 72), the result might be less pixels than the maximum entered. This could be desired behavior, or possibly not. Just know that PPI adjustment happens first, then the image is reduced to limit maximum pixels.
Options unique to particular formats
PSD, TIF, and JPG
Convert to profile — converts color to the selected profile prior to saving a copy of the image. This occurs after merging layers or flattening to ensure any adjustment layers are applied in the original color space before conversion to the selected profile.
Keep paths, Keep clipping path, Discard paths — Keep paths leaves all paths untouched. Keep clipping path discards all except any path set to clipping path. If a clipping path isn’t set, all are discarded. Discard paths removes all paths including any set to clipping path.
PSD and TIF
Layers as-is — layers are untouched and alpha channels are retained, as well as ruler guides. This option does not exist for JPG or PNG. JPG requires the image is flattened. PNG supports a single layer, but not multiple layers, which the input image may have.
IMPORTANT NOTE: This option is disabled when other options are enabled that alter color, pixel dimensions, or paths. Adjustment layers cannot change color space and maintain faithful results; layer effects do not scale when an image is resized; and because shape layers depend on vector paths, the shape is lost if paths are discarded. For these reasons, when the corresponding options are enabled, the image must be merged to a single layer or flattened to maintain appearance.
PSD, TIF, and PNG
Single merged layer — hidden layers are discarded and the remaining layers are merged to a single layer. If a layer mask remains, it is applied. Alpha channels and ruler guides are discarded. The option does not exist for JPG as it must be flattened.
Flatten — result is a single “Background” layer. Alpha channels and ruler guides are discarded. JPG always performs this step.
The above two options are performed before resizing so that any effects, smart objects, and shape layers are rasterized at original resolution to maintain appearance.
Embed color profile — embeds into the JPG the current color profile, either for the original color space if not converted, or the profile selected for the Convert to profile option. JPG is the only format with this option. PSD and TIF always embed the profile (if applicable, based on mode and whether a profile is assigned). The option exists for JPG so that files intended for print can include profiles, important to preserve in that case, but JPG for web may omit profiles, as the profile is excess and only increases file size. The script does not embed profiles in PNG. For an explanation (also applies to JPG for web), see the section Further reading, PNG color space and embedded profiles.
Quality — JPEG image 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, and of course, results in the largest file size. The maximum quality 12 is recommended for print. For web images, 5 to 8 is an acceptable range.
JPG and PNG
Rename for web — detects characters in the file name that require URL encoding, replaces them with a dash, and converts the file name to lowercase. Prevents URLs that look like “…/This%20is%20the%20File%20Name.jpg”. Instead the result is “…/this-is-the-file-name.jpg”.
PNG-8/PNG-24 — the only choice for PNG regarding color is the bit depth. PNG-8 is indexed color, (8 bits per pixel, of a single channel), whereas PNG-24 is RGB color (24 bits per pixel, or 8 bits per channel, of 3 channels). PNG-8 produces smaller files but at the cost of color precision. The user is the judge of that trade-off, and which bit depth is appropriate for the project. For an explanation of why PNG forces a single choice for Convert to profile, see the section Further reading, PNG color space and embedded profiles.
Section 3: Output
Alongside input files, in folders specified above — each format selected to output is saved in the specified folder, which is created in the input folder and in all subfolders if the option is enabled.
Other — select a folder and files are output to the location instead of alongside input files. If Include subfolders is enabled, all are created in the output location.
Whether output is saved alongside input files or in another folder, output files are always saved in each format’s specified Save in folder, which are required and created if needed, including within subfolders. This is necessary to avoid duplicate file name conflicts. If less complex folder structure is desired, use other tools or manually arrange input files in a flat structure before processing.
Replace existing output files — when enabled, existing output files are replaced without user intervention. When disabled, for each existing output file the user is prompted to confirm replacement, skip saving the file, replace all (equivalent to enabling this option), or cancel processing.
Section 4: Settings
The current options may be saved and restored later. Select from the Load drop-down list to choose saved settings, which then updates the current options. Click the Delete button and the saved settings selected in the Load drop-down list are permanently removed. Click the Save button, provide a name for the settings, and the current options are preserved. If the name already exists, the user may choose to replace the saved settings.
The script provides default saved settings named [Default]. These settings cannot be deleted but may be updated to any desired values by saving settings and providing the name [Default], which then overwrites the default settings.
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.
If you’ve reached this point, you know enough to use the script. The remainder is not crucial to read, but helps understand how the script works. This section is last, in the interest of minimizing “Too Long; Didn’t Read.”
Image modes and how each is processed
Of the formats Photoshop can open, the script recognizes aspects of the image and acts intelligently based on the output format. Depending on the combination of factors, images are either processed without issue, or a warning is reported in the log file when particular situations are encountered.
Bitmap — PSD and TIF support bitmap mode, but if asked to Convert to profile, the request is not supported. In this case, the image is converted to grayscale and then to the selected color profile. If Convert to profile is not enabled, bitmap images remain bitmap in PSD and TIF. JPG does not support bitmap mode, and though technically PNG does, saving bitmaps as PNG makes little sense as the format’s intent is for web graphics. JPG and PNG bitmaps are converted to grayscale, then if enabled, to the selected color profile.
Duotone — PSD is the only format (of those the script provides) that supports duotone mode. If Convert to profile is enabled, the image is converted to RGB and then to the selected color profile, otherwise remains duotone mode. TIF, JPG, and PNG do not support duotone mode, so always convert to RGB, then if enabled, to the selected color profile.
Indexed color — PSD, TIF, and PNG-8 support indexed colored and unless converted retain the original color space. JPG and PNG-24 formats do not support indexed color and convert to RGB, then if enabled, to the selected color profile.
Spot color channels — PSD and TIF are the only formats (of those the script provides) that support spot channels. For these formats, whether or not Convert to profile is enabled, spot channels are ignored and remain as-is. JPG and PNG convert to RGB and then merge spot channels to replicate the appearance of the image with the spot colors. Then, if enabled, color is converted to the selected profile.
Multichannel — PSD is the only format (of those the script provides) that support multichannel mode. Because converting multichannel to other color spaces is unreliable, the script does not attempt to do so. Therefore, there is never a change in mode. Multichannel images remain as-is. TIF, JPG, and PNG do not support multichannel mode, and because converting to other color spaces is unreliable, these formats are not saved. A warning to that effect is reported in the log file. It is recommended to work with multichannel images directly in Photoshop rather than use automated tools such as this script.
16 and 32 bits per channel — PSD and TIF support more than 8 bits per channel and will retain values higher than 8 unless Convert to profile is enabled, in which case the image is converted to 8 bits per channel and then to the selected color profile. In all cases, whether converting color or not, JPG and PNG are converted to 8 bits per channel. For the choice PNG-8, the image is further reduced to single channel 8-bit indexed color. 32 bits per channel is not entirely compatible with color management and may result in undesired color shifts, whether converting color or not. It is recommended to work with 32-bit images directly in Photoshop rather than use automated tools such as this script.
TIF images are always saved with LZW compression and ZIP layer compression (if layers are preserved). The script does not provide other TIF compression options.
When saved, format option used is Baseline Standard for maximum compatibility.
PNG color space and embedded profiles
For PNG, Convert to profile is always sRGB. Technically, the PNG format supports bitmap mode and other RGB color spaces, including embedding their profiles, but this makes little sense. PNG (“Portable Network Graphic”) is intended to convey imagery for the Internet (the “network” in its name). The standard for web imagery is sRGB. Most browsers and consumer electronics won’t bother to detect a color profile, rather assume imagery is sRGB, and when images are, colors match reasonably well. Not to suggest these devices are perfectly calibrated, or that none honor profiles, only that color matches better when sRGB compared to other color spaces. And it makes no sense to use PNG for working files or those destined for print, cases in which other color spaces and preserving profiles are important. By design, the script always outputs PNG files in untagged sRGB color space.
Duplicate file names
To protect against duplicate file names overwriting one another, files are output to specified folders. However, because output files are the file’s base name (name without extension) plus the output format extension added, there remains one situation in which duplicate file names could occur — when input files of different extensions, in the same folder, have the same base name. When this circumstance exists, the base name retains the input file extension, which is normally replaced by the output format extension. Any output file with two extensions (because the input extension is retained) is not a glitch; it is named this way to prevent duplicate names overwriting one another.
Available color profiles
For the option Convert to profile, the list of profiles from which to choose is complied 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.
Batch Multi Save
- Initial release.
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.