Geoff Overfield Geoff Overfield - 1 year ago 108
C# Question

Append a Bitmap?

Is it possible to append a Bitmap file. By this I mean:

Is it possible to load in my initial image, then continue to load in new images, but place them at the bottom of the previous image (maybe with a break of like 20 pixels)?

I've never seen anything like this done before, so if anyone has any experience in doing so, it would be a huge help!!

Answer Source

This should do the trick.

public Bitmap AppendBitmap(Bitmap source, Bitmap target, int spacing)
    int w = Math.Max(source.Width, target.Width);
    int h = source.Height + target.Height + spacing;
    Bitmap bmp = new Bitmap(w, h);

    using (Graphics g = Graphics.FromImage(bmp))
        g.DrawImage(source, 0, 0);
        g.DrawImage(target, 0, source.Height + spacing);

    return bmp;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download