Page 1 of 1

Huge temporary image magick files are generated on disk

Posted: 2018-07-11T22:58:08-07:00
by mgurjar.imagemk
Hello,

We have upgraded version of ImageMagick from "7.0.3.1-Q8-AnyCPU" to "7.4.6.0-AnyCPU" for .Net, but is it still generating huge temporary files on disk on production and causing image functionality stopped. We are using this component to covert images of multiple formats into PNG format.

We have found following errors from log.

->not a jpeg file: starts with 0x00 0x05 `<jpg file path>’ @ error/jpeg.c/jpegerrorhandler/332

->insufficient image data in file `<jpg file path>’ @ error/jpeg.c/readjpegimage/1106

->improper image header `<png file path>' @ error/png.c/readpngimage/4255

->not a jpeg file: starts with 0x3c 0x21 `<jpg file path>' @ error/jpeg.c/jpegerrorhandler/332

->no decode delegate for this image format `MSG' @ error/constitute.c/ReadImage/512

->Failed to read custom directory at offset 366668. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/652

Some forums suggested delegate libraries need to be installed or any patch. We are using OS Windows Server 2012 R2 on production. Please let us know what are delegate libraries or patch need to be installed in our case or any other possible solution.

Delegate libraries:https://www.imagemagick.org/download/delegates/
Patches:https://www.imagemagick.org/download/beta/

Thanks & Regards,
Manish

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-11T23:27:50-07:00
by fmw42
Please, always provide your exact IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-12T01:17:46-07:00
by mgurjar.imagemk
Hello,
Please find details,
Current IM version: Magick.NET-7.4.6.0-Q8-AnyCPU
OS on Production: Windows Server 2012 R2

We have not used command line but below .Net class in web application hosted on IIS 8.5.
.Net class used: ImageMagick.MagicImage

Thanks
Manish

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-12T09:19:33-07:00
by fmw42
I suggest you post your .Net code for a simple example image that shows this effect. That way the developers can try to reproduce the issue.

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-12T22:20:07-07:00
by mgurjar.imagemk
Hello,

I am not able to upload or open JPEG file, let me know if I can email that image(please provide email ID). Also not able to open image in Paint application. It give following error,

Not a JPEG file: starts with 0x74 0x65 `<jpeg file path>’ @ error/jpeg.c/JPEGErrorHandler/332

Can we still read file using IM? Are huge temporary files created because of these errors?

Please find .Net code of IM used in our web application,

To validate image while uploading image,

Code: Select all

          using ImageMagick;

            try
            {
                using (MagickImage image = new MagickImage(filePath))
                {
                    // Valid file
                }
            }
            catch (Exception ex)
            {
                    //log message
             }

To fetch image from file share and convert into PNG format before displaying,

                           using ImageMagick;
                            try
                            {
                                MagickReadSettings settings = new MagickReadSettings();
                                settings.Density = new Density(300, 300);
                                //we need to convert when a processed image is requested.
                                using (MagickImage image = new MagickImage(imageFilePath, settings))
                                {
                                    image.Format = MagickFormat.Png;
                                    image.Write(Response.OutputStream);
                                    Response.ContentType = "image/png";
                                }
                            }
                           catch (Exception ex)
                            {
                                     //log message
                            }
Thanks,
Manish

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-18T22:00:25-07:00
by mgurjar.imagemk
Hello,

Please provide your views on this, we have planned this change/fix in current and next sprints.

Thank you,
Manish

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-18T23:42:34-07:00
by fmw42
It sounds like your image is damaged. You can post your image to any free hosting service and put the URL here. If you cannot do that, then the .NET developer will have to discuss this issue and other means for you to provide your image.

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-18T23:48:33-07:00
by mgurjar.imagemk
Yes, I tried uploading image to some free hosting service but since it is corrupted, I was unable to do so. Developer can share email address, so I can directly send the image.

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-23T05:58:53-07:00
by mgurjar.imagemk
Hello,

Please provide email and any update on this.

Thanks
Manish

Re: Huge temporary image magick files are generated on disk

Posted: 2018-07-25T22:40:35-07:00
by dlemstra
It might be wiser to inspect the content of the temporary files yourself so you can figure out where it fails. I don't think it is likely that this is caused by an invalid JPEG file.