CMYK Value Replace in PDF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MrTorque
Posts: 2
Joined: 2015-08-12T07:12:13-07:00
Authentication code: 1151

CMYK Value Replace in PDF

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CMYK Value Replace in PDF

Post 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.
snibgo's IM pages: im.snibgo.com
MrTorque
Posts: 2
Joined: 2015-08-12T07:12:13-07:00
Authentication code: 1151

Re: CMYK Value Replace in PDF

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CMYK Value Replace in PDF

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply