Layer

A layer object.

Layers may contain nested layers, which are called sublayers in the user interface. The layer object contains all of the page items in the specific layer as elements. Your script can access page items as elements of either the layer object or the document object.

Methods:

move, duplicate, moveToEnd, remove, removeAll, unlink, link, translate, rotate, resize

Objects:

BlendMode, Boolean, Layer, Number, String, XMPMetadata

Property Listing

Property

Type

Access

Description

allLocked

Boolean

read/write

If true, the layer's contents and settings are locked.

blendMode

BlendMode

BlendMode.PASSTHROUGH

BlendMode.NORMAL

BlendMode.DISSOLVE

BlendMode.DARKEN

BlendMode.MULTIPLY

BlendMode.COLORBURN

BlendMode.LINEARBURN

BlendMode.LIGHTEN

BlendMode.SCREEN

BlendMode.COLORDODGE

BlendMode.LINEARDODGE

BlendMode.OVERLAY

BlendMode.SOFTLIGHT

BlendMode.HARDLIGHT

BlendMode.VIVIDLIGHT

BlendMode.LINEARLIGHT

BlendMode.PINLIGHT

BlendMode.DIFFERENCE

BlendMode.EXCLUSION

BlendMode.SUBTRACT

BlendMode.DIVIDE

BlendMode.HUE

BlendMode.SATURATION

BlendMode.COLORBLEND

BlendMode.LUMINOSITY

BlendMode.HARDMIX

BlendMode.LIGHTERCOLOR

BlendMode.DARKERCOLOR

read/write

The mode to use when compositing an object.

bounds

UnitRect

readonly

If the Layer is a layer set, this property returns a reference to the corresponding layer set object.

boundsNoEffects

UnitRect

readonly

Bounding rectangle of the Layer not including effects.

id

Int

readonly

The unique ID of this layer.

itemIndex

Int

readonly

The layer index sans layer groups, how Photoshop would index them.

linkedLayers

Array of Layer

readonly

The layers linked to this layer.

name

String

read/write

The name of the layer.

opacity

Number (range 0 - 100)

read/write

The layer's master opacity (as a percentage). Range: 0.0 to 100.0.

parent

 

readonly

The object's container.

typename

String

readonly

The class name of the object.

visible

Boolean

read/write

If true, the layer is visible.

xmpMetadata

XMPMetadata

readonly

XMP metadata associated with the Layer.

Method Listing

Layer duplicate (relativeObject:Object, insertionLocation:ElementPlacement)

Duplicate this object.

Parameter

Type

Description

relativeObject

Object

 

insertionLocation

ElementPlacement

ElementPlacement.PLACEAFTER

ElementPlacement.PLACEBEFORE

ElementPlacement.PLACEATEND

 

undefined link (with:Layer)

Links the layer with the specified layer.

Parameter

Type

Description

with

Layer

The layer to link to.

Layer move (relativeObject:Object, insertionLocation:ElementPlacement)

Move the object.

Parameter

Type

Description

relativeObject

Object

 

insertionLocation

ElementPlacement

ElementPlacement.PLACEAFTER

ElementPlacement.PLACEBEFORE

ElementPlacement.PLACEATEND

 

undefined moveToEnd ([layerSet:LayerSet])

...

Parameter

Type

Description

layerSet

LayerSet

 

undefined remove ()

Deletes this object.

undefined removeAll ()

Deletes all elements.

undefined resize ([horizontal:Number=Number], [vertical:Number=Number], [anchor:AnchorPosition=AnchorPosition])

Scales the object.

Parameter

Type

Description

horizontal

Number

The amount to scale the object horizontally (as a percentage).

(default: 100)

vertical

Number

The amount to scale the object vertically (as a percentage).

(default: 100)

anchor

AnchorPosition

AnchorPosition.TOPLEFT

AnchorPosition.TOPCENTER

AnchorPosition.TOPRIGHT

AnchorPosition.MIDDLELEFT

AnchorPosition.MIDDLECENTER

AnchorPosition.MIDDLERIGHT

AnchorPosition.BOTTOMLEFT

AnchorPosition.BOTTOMCENTER

AnchorPosition.BOTTOMRIGHT

The point to resize about.

(default: AnchorPosition.MIDDLECENTER)

undefined rotate (angle:Number, [anchor:AnchorPosition=AnchorPosition])

Rotates the object.

Parameter

Type

Description

angle

Number

The number of degrees to rotate the object.

anchor

AnchorPosition

AnchorPosition.TOPLEFT

AnchorPosition.TOPCENTER

AnchorPosition.TOPRIGHT

AnchorPosition.MIDDLELEFT

AnchorPosition.MIDDLECENTER

AnchorPosition.MIDDLERIGHT

AnchorPosition.BOTTOMLEFT

AnchorPosition.BOTTOMCENTER

AnchorPosition.BOTTOMRIGHT

The point to rotate about.

(default: AnchorPosition.MIDDLECENTER)

undefined translate ([deltaX:UnitValue], [deltaY:UnitValue])

Moves the object relative to its current position.

Parameter

Type

Description

deltaX

UnitValue

The amount to move the object horizontally.

deltaY

UnitValue

The amount to move the object vertically.

undefined unlink ()

Unlinks the layer.

Object of

Layer.linkedLayers

Document.activeLayer

Return

Layer.duplicate()

Layers.[]()

Layers.getByName()

Layer.move()