1. Products
  2.   Aspose.PSD
  3.   Aspose.PSD FOSS for Python

Aspose.PSD FOSS for Python

Open-source Python library for loading, inspecting, and saving PSD/PSB files with layer metadata access. MIT licensed, no Adobe Photoshop required.

Open-Source Python Library for PSD/PSB Files

Aspose.PSD FOSS for Python is a free, MIT-licensed, pure Python library for loading, inspecting, and saving Adobe Photoshop PSD and PSB files without requiring Adobe Photoshop or any proprietary runtime. It exposes a lightweight, standalone API centered on PsdImage and Layer, giving Python developers programmatic access to a PSD document’s structure with no native dependencies to compile. The library reads a PSD/PSB file’s dimensions, color mode, bit depth, and compression method, and exposes every layer through PsdImage.layers: each Layer reports its name, bounds, opacity, visibility, and blend mode key (BlendMode), along with lower-level channel information (ChannelInformation) and mask data (LayerMaskData). A subset of layer metadata — name, bounds (left/top/right/bottom), and blend mode — can be modified in place and persisted back to disk with PsdImage.save(); everything else on the surface is read-only by design in this FOSS build. Aspose.PSD FOSS for Python is MIT licensed. Install it with git clone https://github.com/aspose-psd-foss/Aspose.PSD-FOSS-for-Python.git — the library has zero third-party native dependencies, only the Python standard library. For the enterprise product family, see Aspose.PSD — Enterprise Product Family.

Load and Inspect PSD/PSB Files

  • Image.load(file_path) opens a file and returns a PsdImage instance
  • PsdImage.width, height, and channels_count report the canvas dimensions and channel count
  • Document header details are read from the parsed file’s color mode and compression metadata
  • PsdImage.layers returns the full list of Layer objects in document order

Validate and Catalog Design Files

  • Validate a batch of design files before handing them to a downstream process
  • Build a lightweight asset catalog of PSD/PSB dimensions and layer counts
  • Detect PSB (large-document) files that need different handling than standard PSD

Work with Layers

  • PsdImage.layers returns every Layer in document order; each Layer exposes name, bounds, opacity, is_visible, and blend_mode_key
  • Layer.channel_information exposes channel metadata for deeper inspection
  • Layer.channels_count reports how many image channels a layer carries
  • PsdImage.layers itself can be reassigned to remove or reorder layers

Audit Layer Structure

  • Audit a PSD’s layer structure without opening Photoshop
  • Generate a report of layer names, visibility, and blend modes for a design review
  • Identify hidden or zero-opacity layers left over from earlier edits

Edit Basic Layer Metadata

  • Layer.name, Layer.left/top/right/bottom, and Layer.blend_mode_key can be set directly
  • PsdImage.save(file_path) persists the modified document back to disk
  • Reloading a saved file with PsdImage.load confirms the edits round-trip correctly
  • Properties not listed above (channel information, mask data, blending ranges) raise NotSupportedException if set — this build supports metadata-only edits, not full re-authoring

Lightweight, Scriptable Edits

  • Rename layers programmatically as part of an automated file-organization pipeline
  • Reposition or resize a layer’s bounding box without a design tool
  • Batch-update blend modes across many files for consistency

Inspect Channel and Resource Data

  • Layer.channel_information exposes per-channel metadata collections
  • Layer.has_mask_data and has_blending_ranges_data report whether optional sections are present
  • PsdLoadException and PsdSaveException surface load/save errors with clear messages
  • All classes are pure Python with no compiled extension modules

Diagnose and Inspect

  • Diagnose why a particular PSD file fails to load, with a typed exception instead of a generic error
  • Check whether a layer carries mask or blending-range data before processing it
  • Inspect per-channel metadata for format-level diagnostics

Load a PSD File and Inspect Its Layers

Load a file with Image.load to get a PsdImage instance for PSD-specific members.

from aspose_psd_foss.image import Image
with Image.load("test.psd") as image:
    print(f"Width: {image.width}, Channels: {image.channels_count}, Layers: {len(image.layers)}")

Edit Layer Bounds and Blend Mode, Then Save

Layer bounds and blend mode can be changed in place and saved back to disk.

from aspose_psd_foss.psdimage import PsdImage
from aspose_psd_foss.layers.blendmode import BlendMode

with PsdImage.load("test.psd") as image:
    image.layers[0].left = 10
    image.layers[0].top = 20
    image.layers[0].right = 40
    image.layers[0].bottom = 60
    image.layers[0].blend_mode_key = BlendMode.MULTIPLY
    image.save("edited.psd")

with PsdImage.load("edited.psd") as reloaded:
    print(f"Bounds: {reloaded.layers[0].bounds}, BlendMode: {reloaded.layers[0].blend_mode_key}")

Read Channel Information (Read-Only)

Channel information can be read but not reassigned — attempting to set it raises NotSupportedException.

from aspose_psd_foss.psdimage import PsdImage
with PsdImage.load("test.psd") as image:
    layer = image.layers[0]
    channel_information = layer.channel_information
    print(f"Channel count: {layer.channels_count}, first channel: {channel_information[0]}")
    # layer.channel_information = channel_information  # raises NotSupportedException

Frequently Asked Questions

What is the licensing model?

Aspose.PSD FOSS for Python is MIT licensed. You can use, modify, and redistribute it under the terms of the MIT license, including in commercial products.

How do I install Aspose.PSD FOSS for Python?

See the install section above for the current install command.

Which formats can Aspose.PSD FOSS for Python read and write?

It loads and saves PSD and PSB (Photoshop large document) files. It does not render or export pixel data to other raster formats such as PNG or JPEG.

What is the main entry-point class?

PsdImage (a subclass of Image). Load a document with PsdImage.load, then read its layers collection and header properties.

Can I modify layer metadata?

Yes — Layer exposes a working setter for several properties, such as visibility and name, and PsdImage.layers itself has a working setter for replacing the collection. A few specific properties (channel information, mask data, blending ranges, and some document- level resources) are read-only in this FOSS build and raise NotSupportedException if set.

  

Support and Learning Resources