Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active March 21, 2022 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/d72d992adedda680245e5ae82be94650 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/d72d992adedda680245e5ae82be94650 to your computer and use it in GitHub Desktop.
Add Signature on Image Programmatically in Java | Sign Image
// Create an instance of Image class to load the primary image
Image canvas = Image.load("layers.psd");
// Load the secondary image containing the signature graphics
Image signature = Image.load("sample.psd");
// Create an instance of Graphics class to load the primary image
Graphics graphics = new Graphics(canvas);
// Call the DrawImage method with appropriate location
// This code draws the secondary image at the right bottom of the primary image
graphics.drawImage(signature, new Point(canvas.getHeight() - signature.getHeight(), canvas.getWidth() - signature.getWidth()));
// Save output image in PNG format
canvas.save("ImageSignature.png", new PngOptions());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment