views:

66

answers:

2

I'm trying to use Ghostscript and/or ImageMagick to convert each page of a Postscript document into PNG images. The problem is that both produce images that are way too saturated (I think that's the right terminology).

Here are the commands I'm trying:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=page_%02d.png brochure.ps
convert brochure.ps im_page_%02d.png

This is the input Postscript file (brochure.ps from above)

Here's a couple of the output images I'm getting:

Page 1

Page 6

As you can see (especially on the page with the big green map of New Hampshire), the colors of the output PNGs are too bright/saturated. How can I prevent the colors from being changed so much and get a more accurate conversion?

Preview in OS X 10.6 automatically does a very accurate conversion to PNG when you open a Postscript file in it. This leads me to believe there is just something screwy with the way ghostscript converts ps->png (I'm fairly confident ImageMagick is just a wrapper for ghostscript for this operation). Is there a tool besides ghostscript I should be using instead?

Note: As pipitas points out below, the visible difference of colors varies by OS. It is very obvious in OS X 10.6, but apparently not very noticeable in Windows XP.

A: 

You are right in assuming ImageMagick just being a wrapper for Ghostscript when converting from PostScript or PDF to an image format.

I think, this problem can only be solved to anybody's satisfaction once the efforts to add support for ICC profile handling and color management (currently underway) are completed for Ghostscript (design document as PDF). That point in time is close, however. If I understand recent commits to http://svn.ghostscript.com/trunk/ correctly, the next release (which will be dubbed 9.00 and out hopefully in August) will include support for color management via LittleCMS. Yay!

pipitas
BTW, I looked at your **brochure.ps** (using `gswin32.exe` on WinXP) as well as at your **page1.png** and **page6.png** (using the Chrome browser). On ***my*** notebook, there is hardly any visible difference in their color saturation. This result does ***not*** make the need for Ghostscript color management support superfluous, but rather re-enforces it.
pipitas
A: 

OSX 10.4 and up provide sips (scriptable image processing system) and it works well with PDF format. Perhaps it can be a temporary solution until Ghostscript supports color management.

evilrobotz