且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何两个图像合并成一个单一的Jpeg

更新时间:2022-10-22 21:12:53


  1. 加载首个图像使用新位图(文件名)

  2. 加载第二图像相同的方式。

  3. 通过调用的Graphics.FromImage(bitmap1)

  4. 呼叫的graphics.DrawImage(bitmap2 ...)把第二图像上的第一个李>
  5. bitmap1.Save(... )新的图像保存到一个文件中。


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#?

  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.