Here you\'ll find tutorials that don\'t belong to either of the above categories. This is the place for the most extraordinary materials.  Home Photoshop Miscellaneous Layer Properties

Layer Properties


If you are new to scripting for Photoshop, please view our Photoshop Scripting Basics tutorial for an introduction to Photoshop scripting and a few exercises about basic JavaScript.

1. Check for an opened document so that this script will only run if there is an opened document.

if (documents.length > 0) {

}


2. Type in the properties you would like to use. View the Properties for artLayer table below for a list of properties.

if (documents.length > 0) {
blendMode = BlendMode.Overlay;
opacity = 50;
name = "My Photoshop Layer";

}


3. Now we have to tell which layer the properties will be applied to.

if (documents.length > 0) {
activeDocument.activeLayer.blendMode = BlendMode.OVERLAY;
activeDocument.activeLayer.opacity = 50;
activeDocument.activeLayer.name = "My Photoshop Layer";
}


4. We can optimize the code by creating a variable for activeDocument.activeLayer.

if (documents.length > 0) {
var doc = activeDocument.activeLayer
doc.blendMode = BlendMode.OVERLAY;
doc.opacity = 50;
doc.name = "My Photoshop Layer";
}


5. Save the file and run the script inside Photoshop (File> Scripts> Browse). Make sure that you have a document opened or else the script will do nothing.

image 1

Properties for artLayer

Property
Type
Description
allLocked
Boolean
Locks or unlocks a layer.
image 2
Code used in example: allLocked = true
blendMode
BlendMode constant
Sets the blend mode for the layer.
image 3
Code used in example: blendMode = BlendMode.NORMAL
fillOpacity Number Changes the opacity of the filled areas in the layer.
image 4
Code used in example: fillOpacity = 100%
grouped Boolean Groups the layer with the layer below it.
image 5
Code used in example: grouped = true
isBackgroundLayer Boolean Sets the layer as the background layer. Will only work if there are no Background layer.
image 6
Code used in example: isBackgroundLayer = true
kind LayerKind constant Sets the type of layer to either NORMAL or TEXT. Changing a layer to a TEXT layer will only work if the layer is empty/transparent.
image 7
Code used in example: kind = LayerKind.TEXT
linkedLayers Array Set the layers that are linked with the layer.
name String The name of the layer.
image 8
Code used in example: name = "Layer 3"
opacity Number Opacity of the layer.
image 9
Code used in example: opacity = 100
parent Document or layerSet object The parent object that contains this layer.
pixelsLocked Boolean Locks or unlocks the pixels of a layer.
image 10
Code used in example: pixelsLocked = true
positionLocked Boolean Locks or unlocks the position of a layer.
image 11
Code used in example: positionLocked = true
textItem TextItem object The text used in the layer. For text layers only.
image 12
Code used in example: textItem.size = 10;
transparentPixelsLocked Boolean Locks or unlocks the transparent areas.
image 13
Code used in example: transparentPixelsLocked = true
visible Boolean Sets the layer's visiblity.

Code used in example: visible = true


Author's URL: FotoFects
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Advance your current skills or acquire new skills in Photoshop by creating projects using our step-by-step tutorials. More Tutorials: Most Popular Materials | Fresh Materials | TutorialKit New Photoshop Tutorials

Add comments to "Layer Properties"

Only registered users can write comment

No comments yet...