Question

I saw the accepted answer to this question: Script (or some other means) to convert RGB to CMYK in PDF?

...and it mentioned the ICC profile capability of GhostScript 9, and the ability of GhostScript to re-distill a PDF without "re-frying".

This sounds like it might be the solution I've been looking for in my quest to find a way of processing a PDF file to replace a single RGB colour with a specific CMYK value.

Note: I don't want to perform an automated mapping of colours - I want to control which colours get mapped to which other colours (there are only a few colours used).

Trouble is, I know zilch about ICC profiles, and the GhostScript site doesn't actually seem to have any tutorials or information other than details of the command line options.

So: would this ICC profile capability let me define specific RGB colours to be replaced, with specific CMYK relplacements? If so, how do you go about that? Any tutorials out there?

Was it helpful?

Solution

First; you are mistaken that Ghostscript does not 're-fry' the PDF, it most certainly does. The incoming PDF is fully interpreted, converted to a series of graphics primitives and sent to the destination device. If the device is pdfwrite then these are re-assembled into a brand-new PDF file.

What it does not do is convert it to PostScript, but that's not quite the same thing.

As for your actual question; no you can't currently do this, and its unlikely you will be able to do so. For starters pdfwrite normally preserves all colours, it doesn't convert them. If specifically requested it does some conversions, but it doesn't use the ICC profile to do so at the moment, it uses the PostScript defined method for conversion to a specific device space.

When we move on to do the conversion using ICC profiles then you will be able to specify profiles to do the conversion, and in this case you will indeed be able to control the conversion. To do this you will need to understand ICC profiles quite thoroughly, and this is well beyond the scope of an answer here. There are books on the subject of colour and these generally include information on ICC profiles.

To be honest, you would probably be a lot better off simply modifying the Ghostscript pdfwrite device to do what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top