temporary magick files left behind

Jun 3, 2014 at 11:34 PM
I've noticed that after converting numerous files in batch that I lost a lot of space on my machine. Apparently there are a ton of temporary image files that are left behind sometimes when converting files. They all begin with "magick-xxxxxxxx:"

The only link that I could find that provided any real info is this one:

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=23951

The part in the link I find confusing is it says "if IM crashes". But IM isn't actually crashing because the images are converting. So I'm a little confused.

I understand that this is not directly related to Magick.net but is there a call I can make using Magick to prevent this. Whether it's calling dispose on my MagickImage objects or anything like that. Calling Dispose didn't actually help. They still appeared. It seems that the only way I can remove is to periodically manually delete them.

Is there a better way?
Coordinator
Jun 4, 2014 at 4:59 AM
The temporary files should be removed automatically. This might be a bug in the code of ImageMagick. Can you e-mail me one of those files so I can see the content? It might help me figure out why it is happening. It would be even better if you have a small code example and one image that I can use to reproduce the problem.
Jun 4, 2014 at 12:00 PM
Using this image:
 https://www.dropbox.com/s/rvlobf0ygxz89kp/AT_SPACE4C01_CS_CIROS.eps
and this code:
     var destinationStream = new FileStream(@"C:\test.jpg", FileMode.Create);

        //this is the image in dropbox
        string sourceFilePath = sourceFile;

        using (MagickImage magickImage1 = new MagickImage(sourceFilePath))
        {
            magickImage1.Strip();
            magickImage1.Format = MagickFormat.Jpg;
            magickImage1.Density = new MagickGeometry(300, 300);

            destinationStream.SetLength(0);

            magickImage1.Write(destinationStream);
        };
The following temp file gets left behind. This particular temp file is empty(0 kb), but still left behind. Let me know if you need me to send you an example where the temp file has data inside.
 https://www.dropbox.com/s/21eghda1b45tmhc/magick-11068czWiyinCfnP0
Jun 4, 2014 at 2:41 PM
Here's a temp file that has data in it.
https://www.dropbox.com/s/xjhyniheuyr1gnv/magick-1444_fCEmoBB7yp2
Unfortunately, I do not know what image file is associated with that. So this tmp file may not be halpful
Coordinator
Jun 4, 2014 at 9:16 PM
Edited Jun 4, 2014 at 9:16 PM
I was able to reproduce the 0kb file problem and I fixed this in ImageMagick. This will be fixed in the next release of Magick.NET.

The other temporary file looks like pixel data. Is it possible that this was from a crash that happened earlier? Please let me know if you can create a reproducible situation like the 0kb example.
Jun 5, 2014 at 1:03 AM
Sweet. Thanks.

Also, I'm not exactly sure if the other temporary file was from a crash or not. I tend to run these conversions in batches. I'm of the mind that it might have been because of a crash because I can't reproduce seem to reproduce it so I'll believe that it was. If I come across it again, and I can reproduce it, I'll let you know.

Thanks for your work on this.