---
Product: psd
Platform: net
Page Type: index
Canonical URL: https://blog.aspose.org/psd/net/psd-layers-in-net/
Published: 2026-10-09
Author: Aspose
---

# Working with Layers in Aspose.PSD FOSS for .NET

A deep dive into layer metadata in Aspose.PSD FOSS for .NET: the Layer class's full property set, blend modes, layer mask flags, and the channel/mask/blending-range metadata classes used to describe a PSD layer's structure.

## Introduction

`PsdImage.Layers` returns every layer in a PSD or PSB document as a `Layer` array. This post looks specifically at what a `Layer` exposes: its geometry and visual state, the blend mode and mask flag enumerations, and the metadata classes that describe a layer's channels, mask, and blending ranges.

---

## What's Included

### The Layer Class

Each `Layer` carries a Pascal name (`Name`), a bounding `Rectangle` (`Bounds`, with derived `Width`/`Height`/`Top`/`Left`/`Bottom`/`Right`), visibility and compositing state (`IsVisible`, `Opacity`, `Clipping`, `BlendModeKey`), and a channel count (`ChannelsCount`). `Name`, `IsVisible`, `Opacity`, `Clipping`, `BlendModeKey`, and the four bounds edges can all be changed and written back with `PsdImage.Save()`.

```csharp
using var image = (PsdImage)Image.Load(inputPath);

foreach (Layer layer in image.Layers)
{
    Console.WriteLine($"{layer.Name}: {layer.Bounds}, " +
                       $"Visible={layer.IsVisible}, Opacity={layer.Opacity}, " +
                       $"BlendMode={layer.BlendModeKey}");
}
```

### Blend Modes and Mask Flags

`BlendModeKey` is a `BlendMode` enum value — the library defines all 29 standard PSD blend modes (`Normal`, `Multiply`, `Screen`, `Overlay`, `Darken`, `Lighten`, `ColorDodge`, `ColorBurn`, `HardLight`, `SoftLight`, `Difference`, `Exclusion`, `Hue`, `Saturation`, `Color`, `Luminosity`, and others). A separate `LayerMaskFlags` enum (`None`, `RelativeToLayer`, `Disabled`, `InvertedWhenBlending`, `UserMaskFromRenderingOtherData`, `UserOrVectorMasksHaveParameters`) describes mask-rendering behavior where a layer has one.

### Channel and Mask Metadata

`Layer.ChannelInformation` returns a `ChannelInformation[]` describing each channel's ID, compression method, and byte length. `Layer.LayerMaskData` (an abstract `LayerMaskData`, concretely a `LayerMaskDataShort` when present) describes a layer mask's bounds and flags; `Layer.LayerBlendingRangesData` exposes the composite and per-channel blend ranges. All three of these properties are read-only in this FOSS build — their setters throw `NotSupportedException` if called, even though they appear as regular get/set properties.

```csharp
Layer layer = image.Layers[0];
foreach (ChannelInformation channel in layer.ChannelInformation)
{
    Console.WriteLine($"Channel {channel.ChannelID}: {channel.CompressionMethod}, {channel.Length} bytes");
}

if (layer.LayerMaskData is { } mask)
{
    Console.WriteLine($"Mask bounds: {mask.MaskRectangle}, flags: {mask.Flags}");
}
```

---

## Quick Start

```bash
dotnet add package Aspose.PSD.FOSS
```

```csharp
using Aspose.PSD.FileFormats.Psd;
using Aspose.PSD.FileFormats.Psd.Layers;
using System.Linq;

using var image = (PsdImage)Image.Load("input.psd");

var visibleLayers = image.Layers.Where(layer => layer.IsVisible);
foreach (Layer layer in visibleLayers)
{
    Console.WriteLine($"{layer.Name}: Opacity={layer.Opacity}, BlendMode={layer.BlendModeKey}");
}
```

---

## Supported Formats

| Format | Extension | Read | Write |
|---|---|---|---|
| Photoshop Document | psd | ✓ | ✓ |
| Photoshop Large Document | psb | ✓ | ✓ |

---

## Open Source & Licensing

Aspose.PSD FOSS for .NET is MIT licensed and may be used in commercial products without royalties, with no evaluation watermark or usage limit.

The package is at version 1.0.0 and requires only .NET 10.0 at runtime — it has no other third-party dependencies.

---

## Getting Started

- [Getting Started](https://docs.aspose.org/psd/net/getting-started/)
- [Developer Guide](https://docs.aspose.org/psd/net/developer-guide/)
- [KB Articles](https://kb.aspose.org/psd/net/)
- [API Reference](https://reference.aspose.org/psd/net/)

## Related Resources

- [Aspose.PSD Enterprise Product Family](https://products.aspose.com/psd/)
- [Aspose.PSD — Enterprise Blog](https://blog.aspose.com/)