Page zero issue

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Posts: 10
Joined: 2015-05-19T11:23:43-07:00
Authentication code: 6789

Page zero issue

Post by gustavopi »

For programmers, the first item of a collection is usually the zero. But in my tests, when trying to create a thumb from a PDF document using Ghostscript, the first page got to be 1.

Code: Select all

$img = new Imagick($pdf.'[0]'); // WRONG  :( 
$img = new Imagick($pdf.'[1]'); // OK  :D 
(this example is from a question in stackoverflow)

The error is the same as happened to me we see around the web:

Code: Select all

Fatal error: Uncaught exception 'ImagickException' with message 
'PDFDelegateFailed `[ghostscript library] 
-dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 
"-sDEVICE=pam" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" 
-dUseCIEColor -dFirstPage=1 -dLastPage=1 
 -dname= must be followed by a valid token 
 @ error/pdf.c/InvokePDFDelegate/263'
  in /home/domain/public_html/pdfPreview.php:46 

  Stack trace: #0 /home/domain/public_html/pdfPreview.php(46): 
  #1 {main} thrown in 
  /home/domain/public_html/pdfPreview.php on line 46
The problem is not really about a name (-dname), is because no temporary file is generated to Imagick to load (though).

In my tests, this was happening with this version

Code: Select all

versionNumber: 1680
versionString: ImageMagick 6.9.0-0 Q16 x86_64 2016-05-05
But previous versions (don't know exacly which one) was not generating this error, so wrong codes (as my own) just stop working mysteriously. I found more guys like me, yeah, I was not the only one. I tuck some time to find that the error is not auto corrected anymore (why? You tell me).

I just think people of this cummunity should know about.

Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Re: Page zero issue

Post by broucaries »

magick seems an API issue and maybe a security one. Could you get a glimpse

User avatar
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: Page zero issue

Post by magick »

We did not write not so we maintain iMagick. We did try with the command-line and it appears to work properly:
  • convert rose: rose: wizard: logo: logo.pdf
    convert -verbose 'logo.pdf[0]' rose.png
Does it work as expected and return the first page? Now try [1]. Works? If not, you may need to post to the iMagick maintainers.