C# image concatenation

前端 未结 2 402
悲&欢浪女
悲&欢浪女 2021-01-22 01:41

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

2条回答
  •  深忆病人
    2021-01-22 02:09

    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);
    

提交回复
热议问题