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

Aspose.PSD FOSS for .NET

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

Open-Source .NET Library for PSD/PSB Files

Aspose.PSD FOSS for .NET is a free, MIT-licensed, pure C# 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 .NET 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 .NET is MIT licensed. Install it with git clone https://github.com/aspose-psd-foss/Aspose.PSD-FOSS-for-.NET.git — the library has zero third-party native dependencies, only the .NET BCL. For the enterprise product family, see Aspose.PSD — Enterprise Product Family.

Load and Inspect PSD/PSB Files

  • Image.Load(filePath) or Image.Load(stream) opens a file and returns an Image, cast to PsdImage for PSD-specific access
  • PsdImage.Width, Height, and Size report the canvas dimensions
  • PsdImage.ColorMode (ColorModes), BitsPerChannel, and Compression (CompressionMethod) describe how the pixel data is encoded
  • PsdImage.Version (PsdVersion) distinguishes standard PSD from the large-document PSB variant

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 color modes
  • Detect PSB (large-document) files that need different handling than standard PSD

Work with Layers

  • PsdImage.Layers returns every Layer in document order; PsdImage.ActiveLayer reports which one is active
  • Each Layer exposes Name, Bounds, Opacity, IsVisible, and BlendModeKey (BlendMode)
  • Layer.ChannelInformation and Layer.LayerMaskData expose channel and mask metadata for deeper inspection
  • Layer.ChannelsCount reports how many image channels a layer carries

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.BlendModeKey can be set directly
  • PsdImage.Save(filePath) or PsdImage.Save(stream) persists the modified document back to disk
  • Reloading a saved file with Image.Load confirms the edits round-trip correctly
  • Properties not listed above (channel information, mask data, blending ranges, image resources) 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 Resource Blocks and Document State

  • PsdImage.ImageResources and GlobalLayerResources expose ResourceBlock/LayerResource collections
  • PsdImage.GlobalLayerMaskInfo reports document-wide layer mask info
  • PsdImage.IsFlatten and HasTransparencyData report document-level flags
  • PsdLoadException and PsdSaveException surface load/save errors with clear messages

Diagnose and Inspect

  • Diagnose why a particular PSD file fails to load, with a typed exception instead of a generic error
  • Check whether a file was saved in flattened form before further processing
  • Inspect embedded resource blocks for format-level metadata

Load a PSD File and Inspect Its Layers

Load a file with Image.Load and cast the result to PsdImage for PSD-specific members.

using var image = (PsdImage)Image.Load("test.psd");
Console.WriteLine($"Width: {image.Width}, Channels: {image.ChannelsCount}, Layers: {image.Layers.Length}");
Layer layer = image.Layers[0];
Console.WriteLine($"Bounds: {layer.Bounds}, BlendMode: {layer.BlendModeKey}, Opacity: {layer.Opacity}, Visible: {layer.IsVisible}");

Edit Layer Metadata and Save

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

using (var image = (PsdImage)Image.Load("test.psd"))
{
    image.Layers[0].Name = "Renamed layer";
    image.Layers[0].Left = 10;
    image.Layers[0].Top = 20;
    image.Layers[0].Right = 40;
    image.Layers[0].Bottom = 60;
    image.Layers[0].BlendModeKey = BlendMode.Multiply;
    image.Save("edited.psd");
}

using var reloaded = (PsdImage)Image.Load("edited.psd");
Console.WriteLine($"Name: {reloaded.Layers[0].Name}, BlendMode: {reloaded.Layers[0].BlendModeKey}");

Read Channel Information (Read-Only)

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

using var image = (PsdImage)Image.Load("test.psd");
Layer layer = image.Layers[0];
ChannelInformation[] channelInformation = layer.ChannelInformation;
Console.WriteLine($"Channel count: {layer.ChannelsCount}, First channel length: {channelInformation[0].Length}");
// layer.ChannelInformation = channelInformation; // throws NotSupportedException

Frequently Asked Questions

What is the licensing model?

Aspose.PSD FOSS for .NET 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 .NET?

See the install section above for the current install command.

Which formats can Aspose.PSD FOSS for .NET 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 throw NotSupportedException if set.

  

Support and Learning Resources