We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Place image at position or replace image in frame (in layer x)

I have a PSD file and want to place another image at a specific position.
Which is the preferred way to do this? Place at position x,y? or replace an image in a layer? or other?

@mortenma,

The following code will help you place the image in the layer and set the desired position.

        using (var image = (PsdImage)Image.Load("file.psd"))
        {
            Layer layer = new Layer((RasterImage)Image.Load("picture.png"), true);
            image.AddLayer(layer);

            int x = 100;
            int y = 200;
            int width = layer.Width;
            int height = layer.Height;

            layer.Left = x;
            layer.Top = y;
            layer.Right = x + width;
            layer.Bottom = y + height;

            image.Save("output.psd");
        }