I have two JPEG files with different dimensions:
Image1 (Width1,Height1)
Image2 (Width2,Height2)
I want to create Image3 (Width3, Height3) with Image
I had a similar problem. With this function you can merge multiple Bitmap's into a single image
private Bitmap MergeImages(IEnumerable images)
{
var enumerable = images as IList ?? images.ToList();
var width = 0;
var height = 0;
foreach (var image in enumerable)
{
width += image.Width;
height = image.Height > height
? image.Height
: height;
}
var bitmap = new Bitmap(width, height);
using (var g = Graphics.FromImage(bitmap))
{
var localWidth = 0;
foreach (var image in enumerable)
{
g.DrawImage(image, localWidth, 0);
localWidth += image.Width;
}
}
return bitmap;
}