-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathconvert_smartobject_to_layer.py
More file actions
37 lines (28 loc) · 962 Bytes
/
convert_smartobject_to_layer.py
File metadata and controls
37 lines (28 loc) · 962 Bytes
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
35
36
37
"""Example of converting between smart objects and regular layers.
This example demonstrates how to:
1. Convert layers to smart objects
2. Convert smart objects back to regular layers
3. Manage smart object properties
4. Handle smart object conversions
Key concepts:
- Smart Objects
- Layer conversion
- Smart Object properties
- Layer types
"""
# Import local modules
from photoshop import Session
with Session() as ps:
doc = ps.active_document
# Create a new layer
layer = doc.artLayers.add()
layer.name = "Test Layer"
# Convert to smart object
layer.convertToSmartObject()
print("Layer converted to Smart Object")
# Check if it's a smart object
if layer.kind == ps.LayerKind.SmartObjectLayer:
print("Layer is now a Smart Object")
# Convert back to regular layer
layer.rasterize(ps.RasterizeType.EntireLayer)
print("Smart Object converted back to regular layer")