PsdImage.AddLayer method

Adds the layer.

public void AddLayer(Layer layer)
Parameter Type Description
layer Layer The layer.


The following example demonstrates how you can draw on a newly created layer if the simple constructor version is used in Aspose.PSD


string outputFilePath = "output.psd";

int width = 100;
int height = 100;
using (var image = new PsdImage(width, height))
    var layer = new Layer();
    layer.Bottom = height;
    layer.Right = width;

    Graphics graphic = new Graphics(layer);

    // draw a rectangle with Pen tool
    graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

    // draw another rectangle with Solid Brush in Blue color
    graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));


See Also