Enum PsdLayerKind
What a layer record is: a layer, or one end of a group.
public enum PsdLayerKind
Fields
ClosedGroup = 2A group, closed in Photoshop's layers panel.
GroupEnd = 3The hidden record that marks where a group's layers start, below them.
Layer = 0A layer with pixels, or an adjustment, text or shape layer.
OpenGroup = 1A group, open in Photoshop's layers panel; the layers above it in the list down to its GroupEnd are inside it.
Examples
// Layer records come as metadata, bottom to top as the file lists them; their pixels are not loaded.
using Raster image = Raster.Load("layered.psd");
foreach (PsdLayer layer in ((PsdDetails)image.Metadata.FormatDetails!).Layers)
{
if (layer.Kind == PsdLayerKind.GroupEnd)
{
continue;
}
string kind = layer.Kind == PsdLayerKind.Layer ? "layer" : "group";
Console.WriteLine($"{new string(' ', 2 * layer.Level)}{layer.Name} ({kind}, {layer.BlendModeKey}, opacity {layer.Opacity:P0}{(layer.IsVisible ? "" : ", hidden")})");
}