4

I have an array of Images all of the same size . I should add them to a new image like i have shown in the picture.

Different colors represent different images. enter image description here

deathismyfriend
  • 2,182
  • 2
  • 18
  • 25
  • And by "add" do you mean to add (combine) pixel-wise or do you mean you want to create a larger image that contains all other images in a row or grid? – Mike Dinescu Nov 29 '13 at 21:43
  • I want to create an larger image[should be a size of A4 size paper] and store all these small images like i have shown in the picture – Sanu Uthaiah Bollera Nov 29 '13 at 21:46
  • 1
    Check out http://stackoverflow.com/questions/2075032/c-sharp-image-concatenation and http://stackoverflow.com/questions/6501797/resize-image-proportionally-with-maxheight-and-maxwidth-constraints – Malk Nov 29 '13 at 21:51

1 Answers1

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);
Mayank
  • 8,777
  • 4
  • 35
  • 60