ghostscript 9.26 update breaks imagick readImage for multipage PDF

install ghostscript windows
ghostscript linux

Since the ghostscript update 9.25 -> 9.26 (on debian) last morning we get this error:

ErrorMessage: FailedToExecuteCommand 
`'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT
 -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 
'-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r300x300' 
-dFirstPage=1 -dLastPage=1 '-sOutputFile=/tmp/magick-39903EapVvuyNQxL4%d' 
'-f/tmp/magick-39903VD0GMIpLPaIN' 
'-f/tmp/magick-399031owlSOb4aOEw'' (-1) 
@ error/delegate.c/ExternalDelegateCommand/462

When trying to read the first page of a multipage PDF:

$this->resource = new \Imagick();
$this->resource->setResolution(300, 300);
$this->resource->readImage($path . '[0]');

any idea how this problem can be solved?

See: https://www.ghostscript.com/doc/9.26/History9.htm#Version9.26 See: https://secure.php.net/manual/en/imagick.readimage.php


Almost certainly this bug report:

https://bugs.ghostscript.com/show_bug.cgi?id=699815

Your solutions are; don't use the pngalpha device, don't use FirstPage/LastPage, upgrade to a version with the fix, or downgrade to an earlier version. Though that bug is potentially present in many earlier versions, I don't know why it hasn't exhibited before.

Ghostscript 9.26 breaks pdf to image conversions · Issue #1323 , ghostscript 9.26 update breaks imagick readImage for multipage PDF. install ghostscript windows ghostscript linux. Since the ghostscript update 9.25 -> 9.26 (​on  I ran into this issue trying to use imagemagick with ghostscript via Ruby's MiniMagick gem. Since that doesn't allow me to control the parameters being sent to imagemagick, I had to downgrade ghostscript to 9.25 which solved the problem. – tfwright Dec 17 '18 at 23:10


I don't have "a solution" but can confirm the problem since upgrading to gs 9.26. I figured out, that, as KenS pointed out, everything works fine when removing the parameters -dFirstPage=1 -dLastPage=1 in gs.

What also works is to remove the gs-parameter -dMaxBitmap=500000000. Meaning in PHP, remove the [PAGE] i.e.:

$im = new \Imagick();
$im->readImage('/tmp/test.pdf');

My Working solution was a downgrade to ghostscript 9.22. I am using Ubuntu bionic LTS. Therefore I had to run:

sudo apt-get remove ghostscript
sudo apt-get autoremove
sudo apt-get install ghostscript=9.22~dfsg+1-0ubuntu1 libgs9=9.22~dfsg+1-0ubuntu1 libgs9-common=9.22~dfsg+1-0ubuntu1
sudo apt-mark auto libgs9
sudo apt-mark auto libgs9-common

Public service announcement: Recent Ubuntu ImageMagick update , ghostscript 9.26 update breaks imagick readImage for multipage PDF. Multi tool use. up vote 2 down vote favorite. Since the ghostscript update  Ghostscript, GhostPCL, GhostXPS, and GhostPDL Downloads. This page will help direct you to downloads and information about the open source and commercially licensed releases for: Ghostscript, GhostPCL, GhostXPS, and GhostPDL.


(Ghostscript 9.26) Had the same problem, after increasing setResolution(600, 600) started working again.

PDF to image breaks in Ghostscript 9.26, Another recent update in Debian / Ubuntu has broken PDF thumbnail /​ghostscript-9-26-update-breaks-imagick-readimage-for-multipage-pdf my local development machine running Arch Linux with ghostscript 9.26 either. Ghostscript was originally coded that way, and the heritage remains within the code base. Because the Ghostscript PDF interpreter is currently written in PostScript, it proved necessary to add support for 64-bit integers so that we could process PDF files which exceed 2GB in size.


700314 – Segfault in GS 9.26 with certain PDFs - Bugs, Hey! I just ran into an issue with one of our applications after updating imagemagick (7.0.8-33)/ghostscript (upgraded from 9.22 to 9.26). Ghostscript 9.52 for Linux x86 (32 bit) for all platforms NOTE: The Linux binaries are for testing/evaluation purposes only, they do not come as installers or installable packages.


Вопросы про ghostscript и лучшие ответы, PDF which causes segfault in 9.26 (233.25 KB, application/pdf) Add an attachment (proposed patch, testcase, etc.) Traced it to the call that ImageMagick was making: gs -dQUIET -dSAFER Page 1 Page 2 Please note that it also affects imagemagick convert command and PHP readimage command​. Package: php5-imagick Version: 3.2.0~rc1-1 Severity: normal Hi, This bug appears when reading a PDF with readImage() in imagick-php. Most errors are thrown as an ImagickException. However, when an out-of-range page is requested from a PDF, output is also sent directly to standard output, in addition to the exception.


ghostscript 9.26 update breaks imagick readImage для многостраничного PDF- Ghostscript Multipage PDF to PNG выводит имя файла с помощью Python. 2018-11-19 09:28:41 +0000 Chris Liddell <chris.liddell@artifex.com> e5978ae6d1e4f3dee0a2838ed580b0373e102613. Coverity CIDs: 326829, 326828 and 326827