Varnish Images

JavaScript for Adobe InDesign
Latest update 9/26/2018

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, refer to the related script 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

Option to apply transparency blend mode ‘Multiply’

DownloadVarnish Images

You decide. Reward the author anamount the solution is worth to you.

Instructions for use

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

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.

Apply transparency blend mode ‘Multiply’ to varnish elements —when viewing the layout in InDesign, the added varnish shapes obscure the content beneath them (unless the View menu item Overprint Preview is enabled, or the varnish layer is hidden). It is helpful to see the varnish in a translucent state, able to view it, and view through it to the content below. This allows evaluation of results to confirm varnish shapes and identify instances where the creation of varnish failed. With this option enabled, each varnish element is set to multiply, providing the translucent view described above.

DownloadVarnish Images

CHANGE LOG

Version 18.9.26

Miscellaneous syntax.

Version 18.8.19

Miscellaneous syntax.

When option to create varnish images is enabled, warn if links are missing or modified.

If request to create varnish image and original image is missing or modified, offer to make simple varnish frame.