Page 1 of 1

6.8.9-7: Postscript/PDF failure with ghostscript 8.70

Posted: 2014-09-18T00:11:47-07:00
by remi
Ghostscript 8.70 is the standard version on RHEL / CentOS 5 and 6

With this version and ImageMagick 6.8.9-7 reading .ps or .pdf fails
Reverting coders/ps.c and coders/pdf.c to version 6.8.9-0 solves this issue.

From a quick analysys of the changes in these coders

- previous : rely on command exit code, and retrieve message if needed
- current : rely on output and catch message with PostscriptDelegateMessage

Problem: ghostscript succeeds but display a warning, which raise an exception in ImageMagick.

Code: Select all

Exception: PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pam" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=/tmp/magick-320807xqpPIxdkvMk%d" "-f/tmp/magick-32080x_2jLbAXRyaJ" "-f/tmp/magick-32080lL2VmTkUoDy7"': -dname= must be followed by a valid token @ error/pdf.c/InvokePDFDelegate/256
Issue reported by users of my repository where "recent" versions of ImageMagick are available for Fedora / RHEL / CentOS...

See http://forums.famillecollet.com/viewtopic.php?id=2898 (postscript) and http://forums.famillecollet.com/viewtopic.php?id=2914 (pdf)

Re: 6.8.9-7: Postscript/PDF failure with ghostscript 8.70

Posted: 2014-09-18T03:53:21-07:00
by magick
We need to reproduce the problem before we can offer a solution. Under CentOS 5.10 and ImageMagick 6.8.9-7, we tried:

Code: Select all

-> convert logo: logo.pdf

-> gs -v
GPL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.

-> convert -verbose logo.pdf logo.png
/tmp/magick-14276oHJ8MCcngRES1 PNG 640x480 640x480+0+0 8-bit sRGB 72.7KB 0.010u 0:00.009
logo.pdf PNG 640x480 640x480+0+0 16-bit sRGB 72.7KB 0.000u 0:00.000
logo.pdf=>logo.png PNG 640x480 640x480+0+0 8-bit sRGB 256c 27.5KB 0.070u 0:00.050
[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/tmp/magick-14276oHJ8MCcngRES%d" "-f/tmp/magick-14276bu6Zc7oJple3" "-f/tmp/magick-14276hE-K-JV3sWNd"

-> echo $status
0

 -> identify logo.png
logo.png PNG 640x480 640x480+0+0 8-bit sRGB 256c 27.5KB 0.000u 0:00.000
Can you try these commands? Do they work for you?

You can also add --with-gslib=no to your configure commandline. ImageMagick will then use the 'gs' program rather than the gs library.

Re: 6.8.9-7: Postscript/PDF failure with ghostscript 8.70

Posted: 2014-09-18T06:42:58-07:00
by remi
Yes, convert works... so I need to find why it doesn't work from php/imagick...

Re: 6.8.9-7: Postscript/PDF failure with ghostscript 8.70

Posted: 2014-09-19T04:57:50-07:00
by remi
We can close this one.... very strange conflict in PHP land between gd and imagick extension...

Code: Select all

$ php56 -n  -d extension=imagick.so -r 'var_dump($im = new Imagick("../foo.pdf"));'
object(Imagick)#1 (0) {
}

$ php56 -n  -d extension=gd.so -d extension=imagick.so -r 'var_dump($im = new Imagick("../foo.pdf"));'
Fatal error: Uncaught exception 'ImagickException' with message 'PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/tmp/magick-23206Etf1IQL36Gxr%d" "-f/tmp/magick-2320654fHZEtsfGk7" "-f/tmp/magick-23206pyS5GXbLMJ7M"': -dname= must be followed by a valid token
 @ error/pdf.c/InvokePDFDelegate/256' in Command line code:1