Quickstart
Quickstart
This example loads a PSD/PSB document, prints its header and layer metadata, renames the first layer, and saves the result.
Prerequisites
| Requirement | Detail |
|---|---|
| Python | A supported CPython interpreter |
| Package | Aspose.PSD FOSS for Python installed — see Installation |
- Load the document and print its header.
from aspose_psd_foss.psdimage import PsdImage
with PsdImage.load("input.psd") as image:
print(f"Width: {image.width}, Height: {image.height}")
print(f"ColorMode: {image.color_mode}, Version: {image.version}")- Print each layer’s metadata.
from aspose_psd_foss.psdimage import PsdImage
with PsdImage.load("input.psd") as image:
for layer in image.layers:
print(f"{layer.name}: {layer.bounds}, Visible={layer.is_visible}")- Rename the first layer and save the result.
from aspose_psd_foss.psdimage import PsdImage
with PsdImage.load("input.psd") as image:
if image.layer_count > 0:
image.layers[0].name = f"{image.layers[0].name} (edited)"
image.save("output.psd")Next Steps
- Core API for the full
PsdImage/Imagereference - Layers for the full layer metadata reference
- Core Exceptions for load/save error handling