Combine bitmaps

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to combine several bitmaps together to form a single bitmap. Can
anyone show me some similar sample code?

Thanks.

AJ
 
I need to combine several bitmaps together to form a single bitmap. Can
anyone show me some similar sample code?

How do you want to combine them? Are they all to be drawn one on top of
the other? Do they have transparency? Do you want to tile them somehow?

Without knowing these things, it's impossible to answer your question.
However, here's the basic idea:

Bitmap bmpDestination = new Bitmap(sizeNew.Width, sizeNew.Height);

using (Graphics gfx = Graphics.FromImage(bmpDestination))
{
gfx.DrawImage(bmpSource, new Point());
}

That would take an existing bitmap "bmpSource" and draw it placed at the
upper-left corner of a new bitmap "bmpDestination".

For your own needs, you may modify various things like putting the code in
a loop that enumerates several bitmaps, calculates new positions for the
bitmaps, changing the composition mode, etc.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top