Javascript Adobe IllustratorThis InDesign script enables to switch between the three available stroke alignments, while preserving the whole visible dimensions (including stroke) of a frame.

strokealignment change wo shrinkfatten 005enYou have, in an InDesign document you were provided, a frame containing an image or some text, or simply empty, with a stroke of a given weight. You want to increase this weight only outside the frame without overlapping with the inner area occupied optionally by the image or the text. Or you want to increase this weight only inside the frame, at the expense of the optional content but without overgrowing outside. Yet the creator of the document had the bad idea to let the default stroke alignment “center”. Thus you are forced to calculate how much you will first have to reduce or increase the frame dimensions in order to get a visually identical result with an outside or inside stroke, before you can increase the weight only in the desired direction. In the case of the many users used to display the dimensions in millimeters and the stroke weight in points, the calculation will require fastidious conversions between units.

So this script is designed to avoid to you this effort and enables to switch at will from one to another of the available stroke alignments, no matter which are the measurement units preferences of the document.

The script is designed for rectangular or elliptic items the result will be visually identical for, but not for free shapes and polygons (including triangles). For rectangles, the aspect of the corner shapes will be nearly preserved for the “Bevel”, “Inset” and “Rounded” effects, but the difference will be visible for the “Fancy” and “Inverse rounded” effects.

This script is one of the first ideas that occurred to me when I started to write Adobe scripts in 2013, because in InDesign documents converted from QuarkXPress ones, the frames with an inside stroke in the original document systematically ended with a centered stroke and dimensions (without stroke weight) accordingly reduced in InDesign. The idea is to change the stroke alignment of an item, then simply change its geometrical bounds (dimensions without stroke) in order to offset the stroke weight to restore the previous visible bounds (dimensions including the stroke). As warned above, the script is intended for the most simple InDesign native item basic shapes: rectangles with or without corner effects, and ovals, and is not intended to handle polygons (including triangles), lines, open or edited paths or paths pasted from Illustrator, which would require to recreate Illustrator’s “Offset Path” command using actual Bezier curves processing (destructive) like mentioned here ▶ Using InDesign as a CAD Tool -

Add comment

Follow Scriptopedia to Social Network

Scriptopedia sur facebook


An original idea from Loic Aigon, designed by Eddy.VH. It 's a scripts library for Desktop Publishing Adobe products. Find Javascript for Photoshop, Illustrator, inDesign and Acrobat or ATN scripts ( Photoshop actions ) you need.