Converting CMYK PDF to sRGB PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wardrop
Posts: 5
Joined: 2014-02-09T17:10:27-07:00
Authentication code: 6789

Converting CMYK PDF to sRGB PNG

Post 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.
wardrop
Posts: 5
Joined: 2014-02-09T17:10:27-07:00
Authentication code: 6789

Re: Converting CMYK PDF to sRGB PNG

Post 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.
Post Reply