Class PsdMask
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
DefaultColor
Gets the mask's value outside Bounds: 0 (hidden) or 255 (shown).
public int DefaultColor { get; }
Property Value
Density
Gets the mask's density, 0 to 1: how much of the hiding applies.
public float Density { get; }
Property Value
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
IsDisabled
Gets whether the mask is turned off, so it does not hide anything.
public bool IsDisabled { get; }
Property Value
Pixels
public Raster Pixels { get; }