Varnish Images

Script for Adobe InDesign
Latest update 12/17/2023, version 4.3

The script automates the creation of a varnish layer that contains a matching shape for each image in the document. For each varnish element created, the fill color is assigned the specified varnish swatch, and the fill is set to overprint. To varnish non-image elements, see to the Varnish Maker.

  • Varnish images in rectangular frames
  • Varnish images masked using clipping paths
  • Varnish images masked using transparency
  • Create varnish version of images if needed
  • Option to include pasted graphics
  • User-configurable localization
Download
Varnish Images
Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell

How-to Video

How to use the script

The interface has two sections: Varnish and Options. Set choices as desired and click the OK button to begin. A progress bar is displayed while processing. If desired, the Edit menu item Undo restores the document to its state prior to launching the script.

The script correctly varnishes most images, but in some cases, the result may not be as desired. For example, an image with white background placed on a similarly white page. Visually this appears as if masked, when in fact, it is not. In this case, the script doesn’t know any better and creates a rectangular shape that matches the containing frame. The artificial intelligence required to automate such cases is beyond the scope of this script. Resolve such instances manually, and to assist, use the related script Varnish Maker to varnish selected elements, including non-image elements.

Section 1: Varnish

These choices determine which categories of images to include. Any category unchecked is ignored.

Images in rectangular frames — most images are placed in a simple rectangular frame. In this case, a frame of matching position and size is created on the varnish layer. The matching varnish frame includes the keyline (stroke) of the original image frame. Note that 1-bit images are ignored.

The frame dimensions are altered in two circumstances: 1. image content does not fill the frame, in which case, the varnish shape is sized no larger than the image content. 2. The frame extends past the document bleed, in which case, the varnish shape is sized so that it does not exceed the document bleed.

Images masked using clipping path — images that have either a Photoshop or InDesign clipping path applied. The image container is duplicated and the image is removed, leaving a polygon shape that matches the clipping path shape. The new element is moved to the varnish layer and its fill color is assigned the varnish swatch.

Images masked using transparency — images that honor native transparency from Photoshop. For example, when a layer mask is applied to a Photoshop layer or group. In this case, there is no vector shape to draw from. To mimic the masked area for varnish purposes, another image is required, in which the visible area is black and the excluded area is white.

To produce a varnish version of an image masked using transparency, in Photoshop the layer transparency is selected and filled with black. Once flattened, the remainder is white. Lastly, the image is converted to grayscale and saved as a TIFF. A grayscale TIFF is best because once placed in the InDesign document, its fill color may be assigned the desired varnish swatch (and fill set to overprint).

If such images have been prepared, the script only needs to know how to match image names to their varnish version, using the next option.

Image name suffix — the suffix assigned to the varnish version of images. The value may be any text so long as the characters are legal for the file system in use (varies between Mac and Windows). The default is “_varnish”. Then the extension “.tif” is added, which the script expects.

Create image if it does not exist — the script calls on Photoshop to create the image following the steps described above for creating varnish images. A message appears on screen, “Photoshop is creating image… Please wait.” If image creation fails, the user is notified and processing continues.

The script expects varnish images to reside in the same folder as original images. If an image is not found and Create image if it does not exist is disabled, an open file dialog is displayed, prompting the user to locate the image.

Once a varnish image is linked, it is moved to the varnish layer, its color is assigned the varnish swatch, and fill is set to overprint.

If this option is enabled and any document links are missing or modified, an alert is displayed. The user may proceed regardless, or exit and remedy the missing/modified links, the recommended choice. If the user chooses to proceed, an alert is displayed as missing/modified links are encountered, providing the user the option to either ignore the image or create a varnish shape to match the image frame.

Include images without link (pasted graphics) — when enabled, creates varnish shapes to match the frames containing pasted images, just as for images in rectangular frames. For pasted images masked with transparency – for example, pasted PNG graphics with transparent background – there is no means to determine the masking. In this case, the entire frame is varnished. It is better to resolve the pasted graphic so that it is linked to a file. Then it is processed correctly.

Include vector placed graphic frames — normally “images” refer to raster graphics. Placed vector graphics such as artwork from Illustrator are normally ignored. To also varnish the containing frames of placed vector graphics, enable this option.

Section 2: Options

Layer name — the name of the InDesign layer on which varnish elements appear. This may be an existing layer. If the layer of the specified name does not exist, it is created above all other layers.

Swatch name — the name of the InDesign swatch assigned to the fill color of each varnish element. This may be an existing swatch. If the swatch of the specified name does not exist, it is created and defined as color type spot, color mode CMYK, and set to 100% cyan. To override the color set for the varnish swatch, create it beforehand and ensure the value here for name matches. Then the existing swatch is used rather than creating a new one.

Language

By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.

English: varnish-images-en-i18n.zip

Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell
Download
Varnish Images

Change log: varnish-images.txt

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

IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.

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

IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.