将两个图像到一个新的图像 [英] Combine two Images into one new Image
本文介绍了将两个图像到一个新的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有不同的尺寸2 JPEG文件:
I have two JPEG files with different dimensions:
Image1的(宽度1,Height1)
Image1 (Width1,Height1)
IMAGE2(宽2,身高2)
Image2 (Width2,Height2)
欲在左侧和IMAGE2右边创建的Image3(Width3,Height3)配Image1的
I want to create Image3 (Width3, Height3) with Image1 on the left side and Image2 on the right.
推荐答案
像这样的东西会给你两个原始图像并排的新形象。
Something like this will give you a new image with the two original images side by side.
Bitmap bitmap = new Bitmap(image1.Width + image2.Width, Math.Max(image1.Height, image2.Height));
using (Graphics g = Graphics.FromImage(bitmap))
{
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, image1.Width, 0);
}
这篇关于将两个图像到一个新的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文