title: Using ImageMagick to remove all color except black in an image?
body: <p>The situation is : I have many images of documents from scanning. I want to keep the document's main content - which is printed in color black (a small range of colors around #000000). But, you know, the documents are always full of colors : stamp, background, decorations, logos...etc.</p>
  
  <p>I just want to keep the TEXTS ONLY which were printed in the color black.</p>
  
  <p>I've tried with <a href="http://www.imagemagick.org" rel="noreferrer">ImageMagick</a> and this command so far:</p>
  
  <pre><code>convert X.png -matte (+clone -fuzz 20% -transparent "#000000") -compose DstOut -composite X1.png
  </code></pre>
  
  <p>But the result was not as expected , the text was very damaged that I cannot read.
  Someone suggested me to increase the fuzz to 70%:</p>
  
  <pre><code>convert X.png -matte (+clone -fuzz 70% -transparent "#000000") -compose DstOut -composite X1.png
  </code></pre>
  
  <p>Then the text appeared to be more readable, but the other colors kept remaining too.</p>
  
  <p>Can you please show me a better solution for my situation? Every suggestion would be highly appreciated!</p>