I have a list of same sized PNGs. I need to create a long image, with all images next to each other. I have no progressed. 🙂
I have loaded all the image paths into a List<>, and then created a BitMap, with the height of the images, and the length of the number of images , multiplied by their widths. (All images are equal dimensions).
I then need to go through each image, and basically paste it into it’s correct position in my BitMap. Can anyone possibly help me with a routine to do this? Iterate through all my items – and paste them onto my Bitmap.
I have tried this, but it’s failing with: Generic GDI Error.
using(Bitmap newFiles = new Bitmap(outputFileWidth, outputFileHeight))
{
using(Graphics graphics = Graphics.FromImage(newFiles))
{
graphics.DrawImage(
testImage,
new Rectangle(0, 0, originalWidth, originalHeight),
new Rectangle(new Point(), testImage.Size),
GraphicsUnit.Pixel);
}
newFiles.Save(@"c:\test.png");
}
I have not yet done the loops. I am just trying to add the first image.
Answer located! Error was due to a locked file. Actually, permission on my folders. And this is a fantastic routine that I hope helps someone else.