2

I have got a PDF document containing a red font which I want to replace by a black font.

I tried the following command according to this answer:

convert -density 300 doc.pdf -fill black -opaque "#e1342d" -fuzz 60% output.pdf

I received the specific color by selecting a pixel's color from the following screenshot I took:

Screenshot of my document's font color (→ jsFiddle containing the original image)

Unfortunately, the document is still the same after converting. I think I misused the -fuzz parameter.

The distance can be in absolute intensity units or, by appending % as a percentage of the maximum possible intensity (255, 65535, or 4294967295).
ImageMagick command-line documentation

I've tried 0%, 10%, 20%, ... 100%, but none worked.


I wanted to verify that Imagick actually loads and converts the PDF:
convert -density 300 doc.pdf -fill black +opaque red output.pdf

Funnily enough, this outputs a completely white PDF (note that the page count was preserved).
The command below outputs a completely yellow PDF.

convert -density 300 doc.pdf -fill blue +opaque blue output.pdf


My system:

  • Ubuntu 13.10 64-bit
  • ImageMagick 6.7.7-10 2013-09-10 Q16
  • Ghostscript 9.10
ComFreek
  • 591

1 Answers1

2

I achieved the correct result with a slightly different command:

convert -density 300 input.pdf -fuzz 55% -fill black -opaque "#e1342d" out.pdf

tested on Windows with ImageMagick 6.4.4 2008-09-27 Q16

Andrea
  • 1,536