@sharon glipman , I make some changes on your code and it could add space between two images.
My idea is that we could add the width when we merge the second image.
Code:
private Bitmap MergeImages(Image image1, Image image2,int space)
{
Bitmap bitmap = new Bitmap(image1.Width + image2.Width+space, Math.Max(image1.Height, image2.Height));
using (Graphics g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Black);
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, image1.Width+space, 0);
}
Image img = bitmap;
img.Save("D:\\3.jpg");
return bitmap;
}
Bitmap b = MergeImages(img1, img2,10);
In order to test the result, I used the same picture and set the picture background color is black.
Result:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.