Hi guys,
I got Out of Memory Exception while run the below code. I dont know how to resolve this. Will appreciate if somebody help me.
foreach (var file in Directory.GetFiles(Path.GetDirectoryName(txtinputimage.Text) + "\\Thumbnail").ToList().Where(k => !k.EndsWith(".thumb")))
{
Image image = Image.FromFile(file); // Got the Exception in this line.
Image thumb = image.GetThumbnailImage(180, 120, () => false, IntPtr.Zero);
thumb.Save(Path.ChangeExtension(file, "thumb"));
image.Dispose();
thumb.Dispose();
File.Delete(file);
}
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Manav PandyaRank #166 · 14.3K reputationPosted Jun 27, 2018, 3:41 AM EDT
Jeeva SubburajRank #720 · 3.3K reputationPosted Jun 27, 2018, 9:01 AM EDT