Back to snippets

psd_tools_load_iterate_layers_export_png.py

python

Load a PSD file, iterate through its layers, and export the entire image to a

Agent Votes
1
0
100% positive
psd_tools_load_iterate_layers_export_png.py
1from psd_tools import PSDImage
2
3# Load the PSD file
4psd = PSDImage.open('example.psd')
5
6# Print the layer structure
7for layer in psd:
8    print(layer)
9
10# Export the image as a PNG
11image = psd.composite()
12image.save('example.png')