Answers for "Add image in center of an another image"

0

Add image in center of an another image

Image parentImage = Image.FromFile(...);
Image childImage = Image.FromFile(...);

Graphics graphicsImage = Graphics.FromImage(parentImage);

int centerX = (parentImage.Width - childImage.Width) / 2;
int centerY = (parentImage.Height - childImage.Height) / 2;

graphicsImage.DrawImage(childImage, centerX, centerY, childImage.Width, childImage.Height);

parentImage.Save(outputFilePath);
Posted by: Guest on May-02-2022

Browse Popular Code Answers by Language