Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active March 16, 2022 08:18
Show Gist options
  • Save aspose-com-gists/c2123ec26043dfd22c7da2a8062be78c to your computer and use it in GitHub Desktop.
Save aspose-com-gists/c2123ec26043dfd22c7da2a8062be78c to your computer and use it in GitHub Desktop.
How to create PSD file in C# | How to make a PSD
// Create a new image from scratch
PsdImage image = new PsdImage(450, 450);
// Fill image data
Graphics graphics = new Graphics(image);
graphics.Clear(Color.White);
// Draw a rectangle
graphics.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));
// Draw a ellipse shape by specifying the Pen object, color and coordinates
graphics.DrawEllipse(new Pen(new SolidBrush(Color.Red)), new Rectangle(60, 80, 130, 90));
// Add a text layer
image.AddTextLayer("Sample text", new Rectangle(150, 220, 100, 130));
// Save output PSD file
image.Save("CreatePSD.psd");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment