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!
CMYK Value Replace in PDF
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: CMYK Value Replace in PDF
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.
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
Re: CMYK Value Replace in PDF
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?
How could i do it with rasterised pages?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: CMYK Value Replace in PDF
Okay. Colours can be changed with a number of methods. A common method is:
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.
Code: Select all
-fuzz X% -fill A -opaque B
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