Hello, great product, thanks for it. I had to develop c# application using MagickImage. Application shows picture in winforms picturebox. Also there is a listbox in a form with images fileinfos, holded in current folder. All images are the same type, tipycally b/w 16bpp pgm. The images are quit small - 300-800px square and were captured by a b/w video camera.
The common situation is when there are thowsands of images in the list. Choosing the next file in list changes the image in picturebox. So, if I press and hold keyboard arrow button, the image in list and picturebox image changes very quickly, like in a movie. When hundreds of images are passed, MagickImage crashes with StackOverflowException. If I list some images and pause for a little, everythig works fine.
Any try catch blocks don't help. You can see this behavior in my application PGMania http://sourceforge.net/projects/pgmania/
Test files can be downloaded here https://yadi.sk/d/mjuOEKr4eGE69
A piece of code I used:
private void ShowImageFile(string fileName)
The common situation is when there are thowsands of images in the list. Choosing the next file in list changes the image in picturebox. So, if I press and hold keyboard arrow button, the image in list and picturebox image changes very quickly, like in a movie. When hundreds of images are passed, MagickImage crashes with StackOverflowException. If I list some images and pause for a little, everythig works fine.
Any try catch blocks don't help. You can see this behavior in my application PGMania http://sourceforge.net/projects/pgmania/
Test files can be downloaded here https://yadi.sk/d/mjuOEKr4eGE69
A piece of code I used:
private void ShowImageFile(string fileName)
{
byte[] data = File.ReadAllBytes(fileName);
using (MagickImage image = new MagickImage(data))
{
ColorSpace originalColorSpace = image.ColorSpace;
format = originalColorSpace.ToString();
bitDepth = image.BitDepth();
pictureBox.Image = null;
GC.Collect();
try
{
panel1.AutoScroll = false;
pictureBox.Dock = DockStyle.Fill;
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
Bitmap bm = new Bitmap(image.ToBitmap());
pictureBox.Image = bm;
pictureBox.Height = pictureBox.Image.Height;
pictureBox.Width = pictureBox.Image.Width;
ColorSpace transformedColorSpace = image.ColorSpace;
double windowZoom = (double)pictureBox.Width / image.Width;
windowZoom = Math.Round(windowZoom * 100, 0);
GC.AddMemoryPressure(data.Length);
}
catch
{
}
}
}