string src = "src.psd";
string result = "watermarked.png";
string watermarkText = "MyWatermark";
using (PsdImage psdImage = (PsdImage)Image.Load(src))
{
Layer layer = psdImage.AddRegularLayer();
using (SolidBrush brush = new SolidBrush(Color.Black))
{
Graphics graphics = new Graphics(layer);
Font font = new Font("Arial", 40.0f);
float width = watermarkText.Length * font.Size * 0.8f;
float height = font.Size * 2;
float x = layer.Width / 2f - width / 2f;
float y = layer.Height / 2f - height / 2f;
graphics.Transform = new Matrix();
var centerPoint = new PointF(layer.Width / 2f, layer.Height / 2f);
graphics.Transform.RotateAt(45, centerPoint);
brush.Color = Color.FromArgb(128, brush.Color);
for (int i = 0; i < 9; i++)
{
x = i % 3 * width;
y = (int)(i / 3d) * height * 2f;
var layoutRect = new RectangleF(x, y, width, height);
graphics.DrawString(watermarkText, font, brush, layoutRect);
}
}
psdImage.Save(result, new PngOptions());
}