ImageMagick CMYK to RGB

WOOOHOOOO! I finally got it sorted, so I thought I should share it with the hordes of people having issues converting CMYK postscript files(e.g. ai eps etc) to an RGB bitmap.

The problem is not with ImageMagick, it is to do with GhostScript using its ‘default’ crappy algorithm to convert CMYK to RGB.

Make sure you are using the ‘patched’ version of GhostScript. Read here for more. The only problem with this is that when you call GhostScript you need to set a command line option of ‘-dUseCIEColor‘. The thing is you are not calling GS, ImageMagick is!

There is a very simple work around for this. You need to open the ‘delegates.xml’ or ‘delegates.mgk’ (dependant on your version of IM) within your ImageMagick installation directory and add the option after every “@PSDelegate@” or “gs”. For example:

<delegate decode="ps:alpha" restrain="True" command='"@PSDelegate@" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-g%s" "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s"' />

becomes

<delegate decode="ps:alpha" restrain="True" command='"@PSDelegate@" -dUseCIEColor -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-g%s" "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s"' />

Hope this helps… if you have any issues give me a shout.


About this entry