Page 1 of 1

Converting CMYK PDF to sRGB PNG

Posted: 2019-09-23T23:16:50-07:00
by wardrop
Hi all,

I use to be able to run a command like this using ImageMagick 6.x to convert a CMYK PDF to a PNG image:

Code: Select all

magick -colorspace sRGB input.pdf output.png
This could be combined with -resize to give me a nice thumbnail of a PDF. In ImageMagick 7 (v7.0.7-34, using GhostScript 9.26), I instead get an error that looks like this:

Code: Select all

magick: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' -dFirstPage=1 -dLastPage=1 '-sOutputFile=/tmp/magick-14647WacR78O8Ph1%d' '-f/tmp/magick-1464d2IonIEo0TJ4' '-f/tmp/magick-1464o76XGjKsznc8'' (-1) @ error/delegate.c/ExternalDelegateCommand/462.
If I remove "-colorspace sRGB" it completes successfully, but of course the colours in the output are all wonky. Does anyone know what's going on here? Is there another way I should now be doing this in ImageMagick 7? I've already spent hours on this.

Re: Converting CMYK PDF to sRGB PNG

Posted: 2019-09-23T23:30:42-07:00
by wardrop
Turns out I already hit this some time ago and found it be a GhostScript 9.26 bug: https://www.imagemagick.org/discourse-s ... 84#p162084

What a waste of time. AArrghh! Makes sense as I downgraded GhostScript back then to work-around it. I'm not running this on another box. I thought the error looks familiar.