Class PostResource

PostResource class

Class PostResource. Posterize layer settings.

public class PostResource : AdjustmentLayerResource

Constructors

NameDescription
PostResource()The default constructor.

Properties

NameDescription
override Key { get; }Gets the layer resource key.
override Length { get; }Gets the layer resource length in bytes.
Levels { get; set; }Levels of Posterize layer.
override PsdVersion { get; }Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
override Signature { get; }Gets the signature.

Methods

NameDescription
override Save(StreamContainer, int)Saves the resource to the specified stream container.
override ToString()Returns a String that represents this instance.

Fields

NameDescription
const TypeToolKeyThe type tool info key.

Examples

The following code demonstrates the ability to manipulation of PostResource.

[C#]

string sourceFile = "zendeya_posterize.psd";
string outputFile = "zendeya_posterize_10.psd";

using (var image = (PsdImage)Image.Load(sourceFile, new PsdLoadOptions()))
{
    Layer layer = image.Layers[1];

    foreach (LayerResource resource in layer.Resources)
    {
        if (resource is PostResource)
        {
            ((PostResource)resource).Levels = 10;
            image.Save(outputFile);

            break;
        }
    }
}

See Also