8

I have the following png image:

enter image description here

I want to convert the edges that aren't black to black. I have tried

convert <input> -threshold 80% <output>

but this gives

enter image description here

which has changed the look of the graph.

How can I do this without changing the way to graph looks, apart from the color?

Simd
  • 967

1 Answers1

16

Part of the issue is that not only do you have to find a good crossover value for the reds, but also yellows & blues, because the 'black' text is horribly antialiased in colour.

enter image description here

If you apply a simple threshold filter, then the yellows & blues in this affect how the apparently black lettering changes, as well as the reds.
This is what makes the font weights & red line look wrong.

enter image description here

In something like Photoshop [& probably Gimp too, which does run on nix] you can ease this out to give a smoother result.

enter image description here

This is how much manipulation it takes to try balance it up

enter image description here

This is still guesswork & not exactly perfect, but gives this at original size

tweak

The font & line weights at least now look vaguely similar. A bit more patience and trial & error & you could probably get even closer.

Tetsujin
  • 50,917