tags:

views:

118

answers:

2

I need to be able to take multiple images and overlay a smaller one on top of a larger one and save the result as a single image. How would I go about accomplishing this in C#?

A: 

It depends on the environment that you're working and what you want to do with the resulting image.

For example:

If it's within a Winforms or console application then GDI+ would be one way to do it. Examples of how to do such manipulations can be found at http://www.bobpowell.net/gdiplus_faq.htm

If it's within a WPF, Silverlight or XNA then there are better alternatives available.

lzcd
+2  A: 
  1. Load the first image using new Bitmap(filename)
  2. Load the second image the same way.
  3. Get a Graphics object by calling Graphics.FromImage(bitmap1)
  4. Call graphics.DrawImage(bitmap2...) to put the second image on the first
  5. Call bitmap1.Save(...) to save the new image to a file.
Josh Einstein