Change colors on PDF file

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
marcoslavorato

Change colors on PDF file

Post by marcoslavorato »

Hello all. I am new using ImageMagick, so I have a got a problem today. I have a PDF generated dynamically, and I need change the color of some elements on first page. It's a vector. How can i change this color? I tried so many times with examples, but any works.

My last try is with this code:

Code: Select all

exec('convert generated-1.pdf -colorspace RGB –fill yellow -fuzz 10% –bordercolor "RGB(0,0,0)" –draw "color 395,95 filltoborder" langlang22.png',$result);
On my PDF I have the #00000 color and I want change this color to yellow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Change colors on PDF file

Post by fmw42 »

if pdf is in rgb colorspace and has no transparency, then

convert image.pdf[0] -fill yellow -opaque black newimage.png

the [0] will select only the first page and the newimage will only be the result for the first page
marcoslavorato

Re: Change colors on PDF file

Post by marcoslavorato »

Really thanks. Worked fine for me.
Post Reply