Pretty simple little program. Take a higher res image. (2-5MB). Rotate the image, Create a preview size of it 600px x 600px, then create a thumbnail size of it. Do this again and again.
I am building the program in VS2013 in Windows 7 64bit on a VMware machine. Runs fine. I'm able to loop through hundreds of images.
But when I run the program on a full Windows 7 64bit machine I get a black screen. No error message, no memory issue, no BSOD, just completely goes black. Then I have to reboot the machine.
I know the first couple lines of the code runs because it creates the directories. But as soon as it gets to the magick.net part, I think that's when it dies.
I initially thought it was because I was testing on 300 images at a time. But it crashes just as hard on 1 image.
Code: Select all
foreach (var file in d.GetFiles("*.jpg"))
{
using (MagickImage image = new MagickImage(file.FullName))
{
MagickGeometry sizeThumb = new MagickGeometry(142, 142);
MagickGeometry sizePreview = new MagickGeometry(600, 600);
// make sure we respect the aspect ratio
sizeThumb.IgnoreAspectRatio = false;
sizePreview.IgnoreAspectRatio = false;
//rotate the image right way up
image.AutoOrient();
//resize for preview & write it
image.Resize(sizePreview);
image.Write(previewPath + file.Name);
//resize for thumb & write it
image.Resize(sizeThumb);
image.Write(thumbPath + file.Name);
//dispose of the image from memory
image.Dispose();
i++;
Console.WriteLine(i);
}
}