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

ImageMagick.MagickDelegateErrorException

Dec 31, 2014 at 10:10 AM
Hi everybody,

I have a problem.

Code;
    {
        using (var list = new MagickImageCollection())
        {
            list.Read(file);
            for (int id = 0; id < list.Count; id++)
            {
                using (MagickImage image = new MagickImage())
                {
                  //  image.Density = new MagickGeometry(144, 144);
                    image.Read( file + "[" + id + "]");
                //    image.Quality = 110;
                    image.Write(destFolder + "" + (id + 1) + ".jpg");
                    lstZiplenecek.Add(destFolder + "" + (id + 1) + ".jpg");
                    image.Dispose();
                }   
            }
        }
    }

This code can read some pdf file, but some pdf file get an error during read(....pdf);

An unhandled exception of type 'ImageMagick.MagickDelegateErrorException' occurred in Magick.NET-x86.dll

Additional information: pdfcevirresime.vshost.exe: PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/golivePC/AppData/Local/Temp/magick-5196obZpLkY2mtfm%d" "-fC:/Users/golivePC/AppData/Local/Temp/magick-51961QGYobt9bUcw" "-fC:/Users/golivePC/AppData/Local/Temp/magick-5196jFEeshyD-NOA"': Unrecoverable error: invalidaccess in put.

What can i do?

Thanks for your helps.
Dec 31, 2014 at 12:05 PM
Edited Dec 31, 2014 at 12:13 PM
Magick.NET uses Ghostscript to read PDF files and it seems that this file cannot be read by Ghostscript. Can you add a link to your file? This might be a bug in Ghostscript.

And why are you reading the same image again? The collection already contains all the pages. You can use the MagickReadSettings class to set a different Density when you read the files in the collection.
Dec 31, 2014 at 12:18 PM
http://we.tl/ONFTLxk3NP --> this is my pdf file

And error;

An unhandled exception of type 'ImageMagick.MagickDelegateErrorException' occurred in Magick.NET-x86.dll

Additional information: pdfcevirresime.vshost.exe: PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/golivePC/AppData/Local/Temp/magick-52807Uleh20RsnAa%d" "-fC:/Users/golivePC/AppData/Local/Temp/magick-5280NHg3IYdD_9ZO" "-fC:/Users/golivePC/AppData/Local/Temp/magick-5280TEwc6yJQlYQ7"': **** Warning: Font Widths array size is smaller than character range.

**** Warning: Font Widths array size is smaller than character range.

**** Warning: Font Widths array size is smaller than character range.

**** Warning: Font Widths array size is smaller than character range.

**** Warning: Font Widths array size is smaller than character range.

**** Warning: Font Widths array size is smaller than character range.

**** Error reading a content stream. The page may be incomplete.

**** Incorrect object count in object stream.

Error: /rangecheck in resolveobjectstream
Dec 31, 2014 at 12:30 PM
Are you using the latest version of Ghostscript?
Dec 31, 2014 at 12:35 PM
I am using 9.15.
Jan 3, 2015 at 9:11 AM
I am also using 9.15 and I can process the image without any problems. Is it possible that you have two versions of Ghostscript installed (x86 and x64)? Maybe Magick.Net/ImageMagick is using another version?

p.s. I will improve the error reporting to also report the version of Ghostscript in the next version of Magick.NET