如何将多张图片合并成一张图片?

4

我有一个相同大小的图片数组。 我应该将它们添加到一个新图像中,就像我在图片中所示的那样。

不同的颜色代表不同的图像。 enter image description here


你所说的“add”,是指逐像素相加,还是要创建一个包含所有图像的行或网格的更大图像? - Mike Dinescu
我想创建一个更大的图像[应该是A4纸大小],并存储所有这些小图像,就像我在图片中展示的那样。 - Sanu Uthaiah Bollera
1
请查看以下两个网址:http://stackoverflow.com/questions/2075032/c-sharp-image-concatenation 和 https://dev59.com/Rmw15IYBdhLWcg3wntAQ。 - Malk
1个回答

4
  1. Identify the size of final image
  2. Create a bitmap with final height and width var bitmap = new Bitmap(width, height);
  3. Draw each image on canvas

    using (var canvas = Graphics.FromImage(bitmap))
    {
        canvas.InterpolationMode = InterpolationMode.HighQualityBicubic;
        //Draw each image (maybe use a loop to loop over images to draw)
            canvas.DrawImage(someImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, Frame.Width, Frame.Height), GraphicsUnit.Pixel);
    
        canvas.Save();
    }
    
  4. Save the final image bitmap.Save("image path", ImageFormat.Jpeg);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接