C# image concatenation

前端 未结 2 401
悲&欢浪女
悲&欢浪女 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:07

    maybe I'm not understanding the question right, but it seems like you could just create a new Bitmap and draw the 3 images into it at the right coordinates, which you should be able to figure out from the individual image dimensions (which I believe the Bitmap object gives you)

    0 讨论(0)
  • 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);
    
    0 讨论(0)
提交回复
热议问题