Page 1 of 1

CMYK Value Replace in PDF

Posted: 2015-08-12T07:20:43-07:00
by MrTorque
Hi!

I am new to the board: Hello Everyone! ImageMagick is great I often use it for jpg/png transformations.

Currently I need to replace color values in a pdf and have no clue how.
I have a PDF (generated out of an Inkscape svg which was exported with cairo to a pdf and then converted to CMYK with gs) in which I want to replace specific cmyk-color values of text and images with my "correct" cmyk-Values (e.g. replace C64%M64%Y64%K64% with C0%M0%Y0%K100%).

Is this possible with imagemagick, and if so, how?
I am looking for a solution which can do batch-processes - what ImageMagick sure can do :)

Thank you in advance!

Re: CMYK Value Replace in PDF

Posted: 2015-08-12T09:17:56-07:00
by snibgo
ImageMagic will rasterise the pages (convert them to pixels). You can then change colours of those images.

If the text is in the PDF as text, rather than as pixels, this is probably a bad thing to do. Likewise, if the images are vectors, converting them to raster images is probably a bad thing.

Re: CMYK Value Replace in PDF

Posted: 2015-08-12T11:07:21-07:00
by MrTorque
The PDF will be printed. For small PDF sizes it would be nice to keep the text as text and the vector graphics as graphic but it is not really necessary as long the resulting pdf has approx. 350 dpi.

How could i do it with rasterised pages?

Re: CMYK Value Replace in PDF

Posted: 2015-08-12T11:28:22-07:00
by snibgo
Okay. Colours can be changed with a number of methods. A common method is:

Code: Select all

-fuzz X% -fill A -opaque B
This changes all pixels that are within X% of colour B into colour A.

This is a binary method. Each pixel is either changed, or not changed. More complex methods shift from one colour to another, with the degree of shift depending on how close the pixel was to the search colour.

I don't do much work in CMYK, so I would convert the image to sRGB first, do the work in RGB, and finally convert it back to CMYK.