Using the Ghostscript's jpeg device to convert CMYK to RGB
Posted: 2009-03-06T16:36:48-07:00
Few years ago I faced the problem that Java cannot display CMYK JPEG images (see bug 4924909 on the SDN bug database), so when I use ImageMagick to convert from CMYK PS or EPS files to JPEG files, I get a CMYK JPEG that cannot be displayed in the Java application that my plug-in is built for.
I found a note on my computer (evidently written by myself…
) stating that a way to convert CMYK PS and EPS files to RGB JPEG is to modify delegates.xml to instruct the Ghostscript program or library to use the jpeg device.
So, I modified the lines for ps:alpha, ps:color, ps:cmyk and ps:mono to use the jpeg device (-sDEVICE=jpeg) and, indeed, it works.
However, I cannot find (or recall) where I learned this trick (it probably came from a thread of the now defunct ImageMagick forum on redux.imagemagick.com
) and I have two questions about this workaround:
1) Is documented somewhere? If not, the fact that the jpeg device doesn't preserve the original color space has to be considered a defect of Ghostscript (v8.50 GPL)? If this is the case, maybe it will be (or has been) corrected in some later release and I could break my workaround by upgrading the Ghostscript library…
2) What downsides do you see in this workaround? Should I change the device only for ps:cmyk and not for the others?
Thanks in advance.
I found a note on my computer (evidently written by myself…

So, I modified the lines for ps:alpha, ps:color, ps:cmyk and ps:mono to use the jpeg device (-sDEVICE=jpeg) and, indeed, it works.
However, I cannot find (or recall) where I learned this trick (it probably came from a thread of the now defunct ImageMagick forum on redux.imagemagick.com

1) Is documented somewhere? If not, the fact that the jpeg device doesn't preserve the original color space has to be considered a defect of Ghostscript (v8.50 GPL)? If this is the case, maybe it will be (or has been) corrected in some later release and I could break my workaround by upgrading the Ghostscript library…
2) What downsides do you see in this workaround? Should I change the device only for ps:cmyk and not for the others?
Thanks in advance.