-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathoperate_layerSet.py
More file actions
34 lines (28 loc) · 1.01 KB
/
operate_layerSet.py
File metadata and controls
34 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""A examples to show you how to operate layerSet."""
# Import local modules
from photoshop import Session
with Session(action="new_document") as ps:
docRef = ps.active_document
# Add a new layerSet.
new_layer_set = docRef.layerSets.add()
# Print the layerSet count.
ps.echo(docRef.layerSets.length)
ps.echo(len(docRef.layerSets))
# Rename the layerSet.
docRef.layerSets[0].name = "New Name"
ps.echo(new_layer_set.name)
# Change the layerSet opacity
new_layer_set.opacity = 90
ps.echo(new_layer_set.opacity)
# Duplicate the layerSet.
duplicate_layer_set = new_layer_set.duplicate()
# Add a new artLayer in current active document.
layer = docRef.artLayers.add()
# Move the artLayer under the duplicate layerSet.
layer.move(duplicate_layer_set, ps.ElementPlacement.PlaceInside)
# Merge the layerSet.
merged_layer = duplicate_layer_set.merge()
ps.echo(merged_layer.name)
# Set visible.
new_layer_set.visible = False
merged_layer.remove()