Adobe 65014293 Scripting Guide - Page 44
Stroking the selection border, Inverting selections, Expanding, contracting, and feathering selections
UPC - 883919153544
View all Adobe 65014293 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 44 highlights
CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 44 JS var docRef = app.documents.add(500, 500) var shapeRef = [ [0,0], [0,100], [100,100], [100,0] ] docRef.selection.select(shapeRef) Stroking the selection border The following examples use the stroke (Stroke/stroke()) command of the Selection object to stroke the boundaries around the current selection and set the stroke color and width. NOTE: The transparency parameter cannot be used for background layers. AS stroke selection of current document using color ¬ {class:CMYK color, cyan:20, magenta:50, yellow:30, black:0} ¬ width 5 location inside blend mode vivid light opacity 75 ¬ without preserving transparency VBS JS Set strokeColor = CreateObject ("Photoshop.SolidColor") strokeColor.CMYK.Cyan = 20 strokeColor.CMYK.Magenta = 50 strokeColor.CMYK.Yellow = 30 strokeColor.CMYK.Black = 0 appRef.ActiveDocument.Selection.Stroke strokeColor, 5, 1, 15, 75, False strokeColor = new solidColor strokeColor.cmyk.cyan = 20 strokeColor.cmyk.magenta = 50 strokeColor.cmyk.yellow = 30 strokeColor.cmyk.black = 0 app.activeDocument.selection.stroke (strokeColor, 2, StrokeLocation.OUTSIDE, ColorBlendMode.VIVIDLIGHT, 75, false) Inverting selections You can use the invert (Invert/invert()) command of the Selection object to a selection so you can work on the rest of the document, layer or channel while protecting the selection. ➤ AS: invert selection of current document ➤ VBS: selRef.Invert ➤ JS: selRef.invert() Expanding, contracting, and feathering selections You can change the size of a selected area using the expand, contract, and feather commands. The values are passed in the ruler units stored in Photoshop preferences and can be changed by your scripts. If your ruler units are set to pixels, then the following examples will expand, contract, and feather