Table of Contents

Class PsdMask

Namespace
Egami.Formats.Psd
Assembly
Egami.dll

A layer's pixel mask: 0 hides the layer, the maximum shows it.

public sealed class PsdMask
Inheritance
PsdMask
Inherited Members

Examples

// ReadLayers gives every layer with its pixels, bottom to top; a group comes after its contents.
using PsdDocument document = PsdImage.ReadLayers("layered.psd");
foreach (PsdLayerImage layer in document.Layers)
{
    if (layer.Pixels is Raster pixels)
    {
        // Each layer at its own size, in the natural type with alpha (Rgba8 here); X and Y place it on the canvas.
        pixels.Save($"layer-{layer.Index}.png");
        Console.WriteLine($"{layer.Info.Name}: {pixels.Width}×{pixels.Height} at ({layer.X}, {layer.Y}), in group {layer.ParentIndex}");
    }
}

Properties

Bounds

Gets where the mask lies on the canvas.

public Rect Bounds { get; }

Property Value

Rect

DefaultColor

Gets the mask's value outside Bounds: 0 (hidden) or 255 (shown).

public int DefaultColor { get; }

Property Value

int

Density

Gets the mask's density, 0 to 1: how much of the hiding applies.

public float Density { get; }

Property Value

float

Feather

Gets the feather radius in pixels Photoshop blurs the mask by when it draws; the values are not blurred.

public double Feather { get; }

Property Value

double

IsDisabled

Gets whether the mask is turned off, so it does not hide anything.

public bool IsDisabled { get; }

Property Value

bool

Pixels

Gets the mask's values: Gray8, Gray16 for a 16-bit file or GrayF32 for a 32-bit one.

public Raster Pixels { get; }

Property Value

Raster