This project has moved and is read-only. For the latest updates, please go here.

temporary magick files left behind

Jun 4, 2014 at 12:34 AM
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:

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 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?
Jun 4, 2014 at 5: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 1:00 PM
Using this image:
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.Format = MagickFormat.Jpg;
            magickImage1.Density = new MagickGeometry(300, 300);


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.
Jun 4, 2014 at 3:41 PM
Here's a temp file that has data in it.
Unfortunately, I do not know what image file is associated with that. So this tmp file may not be halpful
Jun 4, 2014 at 10:16 PM
Edited Jun 4, 2014 at 10: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 2: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.