简体   繁体   English

C# 图像连接

[英]C# image concatenation

What i want to is, take 3 images, that the 1st image, keep it to original size concatenate anothother image to the bottom of it only using 1/2 of the first images size( starting on the left side).我想要的是,拍摄 3 张图像,第一张图像保持原始大小,仅使用第一张图像大小的 1/2(从左侧开始)将另一张图像连接到它的底部。 Then take the 3rd image and put it on the bottom right half of the first image I've looked for example all day, does anybody have an idea or an idea?然后将第三张图片放在我一整天都在寻找的第一张图片的右下半部分,有人有想法吗?

If you ignore aspect ratio:如果忽略纵横比:

        Image img1;
        Image img2;
        Image img3;

        Bitmap display = new Bitmap(img1.Width, (int)(img1.Height * 1.5));
        Graphics g = Graphics.FromImage(display);

        //draw img1 to upper left corner
        g.DrawImage(img1, 0, 0);

        //draw img2 under img1, left side
        g.DrawImage(img2, 0, img1.Height, img1.Width / 2.0f, img1.Height / 2.0f);

        //draw img3 under img1, right side
        g.DrawImage(img3, img1.Width / 2.0f, img1.Height, img1.Width / 2.0f, img1.Height / 2.0f);

也许我没有正确理解这个问题,但似乎您可以创建一个新的Bitmap并在正确的坐标处将 3 个图像绘制到其中,您应该能够从单个图像尺寸中找出(我相信) Bitmap对象为您提供)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM