LinkedLayersManager class

Linked layers manager class.

public sealed class LinkedLayersManager


Name Description
GetLayersByLinkGroupId(short) Gets layers by link group id.
GetLinkGroupId(Layer) Gets the link group ID associated with the layer.
LinkLayers(Layer[]) Links the input layers and return LingGroupId.
UnlinkLayer(Layer) Unlinks the layer..


The following example demonstrates how you can manipulate Linked Layers in Aspose.PSD


string sourceFile = "example.psd";
string outputFile = "psdnet11_output.psd";

// Load an existing image into an instance of PsdImage class
using (var psd = (PsdImage)Image.Load(sourceFile))
    Layer[] layers = psd.Layers;

    // link all layers in one linked group
    short layersLinkGroupId = psd.LinkedLayersManager.LinkLayers(layers);

    // gets id for one layer
    short linkGroupId = psd.LinkedLayersManager.GetLinkGroupId(layers[0]);
    if (layersLinkGroupId != linkGroupId)
        throw new Exception("layersLinkGroupId and linkGroupId are not equal.");

    // gets all linked layers by link group id.
    Layer[] linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);

    // unlink each layer from group
    foreach (var linkedLayer in linkedLayers)

    // retrieves NULL for a link group ID that has no layers in the group.
    linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);
    if (linkedLayers != null)
        throw new Exception("The linkedLayers field is not NULL.");

See Also