I'm triyng to cycle through all my images for a web site an set them to a specific size. I found the solution to do this, I tested a single image and it worked fine. But when trying to make it cycle thorugh all the images in the directory I get a GDI+ generic error on every image.
That same code works when trying to apply the code to one image and not cycling through. Why would it not work when trying ot massivly apply it to all images in a directory?
Question
sathenzar
I'm triyng to cycle through all my images for a web site an set them to a specific size. I found the solution to do this, I tested a single image and it worked fine. But when trying to make it cycle thorugh all the images in the directory I get a GDI+ generic error on every image.
static void Main(string[] args) { string[] files = Directory.GetFiles("./"); for (int i = 0; i < files.Length; i++) { Image imgPhotoV = Image.FromFile(@"C:\SNDImages\images\" + files[i].Replace("./", "")); Image imgPhoto = null; imgPhoto = DRSImgResize.FixedSize(imgPhotoV, 190, 123); imgPhoto.Save(@"C:\SNDImages\images\" + files[i].Replace("./", ""), ImageFormat.Jpeg); imgPhoto.Dispose(); imgPhotoV.Dispose(); imgPhotoV = null; } Console.ReadLine();That same code works when trying to apply the code to one image and not cycling through. Why would it not work when trying ot massivly apply it to all images in a directory?
Link to comment
Share on other sites
0 answers to this question
Recommended Posts