title: Binarized bitmap not saving binarized in C#
body: <p><strong>Scope:</strong></p>
  
  <p>I am trying to "Binarize" ( convert to only two colors ) the images that can be found <a href="http://www.fazenda.rj.gov.br/projetoCPS/codigoImagem" rel="nofollow noreferrer">here</a>. The binarized output must follow this logic : Characters will be painted as a "Color X" and everything else will be painted as "Color Y".</p>
  
  <p>Ideally X is White and Y is black( but X and Y does not really matter). </p>
  
  <p><strong>Observations:</strong></p>
  
  <p>After some observations, i figured out that the characters are either "Yellow tones", "White Tones" or "Black Tones". 
  Using the code Bellow, i should be able to recognize and convert all those "tones" (Color channels thresholding) to one color, and whole rest, into another color.</p>
  
  <p><strong>Code Sample:</strong></p>
  
  <pre><code>// My Own Web Requests Class. You can use C# 
  WebRequests wr = new WebRequests();  
  
  Native One
  Bitmap bmp;
  string url = "http://www.fazenda.rj.gov.br/projetoCPS/codigoImagem";
  
  bmp = wr.GetBitmap(url);
  bmp.Save(@"captcha.bmp");
  
  for (int i = 0; i &lt; bmp.Width; i++)
  {
      for (int j = 0; j &lt; bmp.Height; j++)
      {
          Color pixel = bmp.GetPixel(i, j);
          byte R, G, B;
  
          // Fetching RGB Values
          R = pixel.R;
          G = pixel.G;
          B = pixel.B;
  
          // Converting Black tones 
          if ((R &lt; Color.Black.R + 110)
              &amp;&amp; (G &lt; Color.Black.G + 110)
              &amp;&amp; (B &lt; Color.Black.B + 110))
          {
              bmp.SetPixel(i, j, Color.Orange);
              continue;
          }
  
          // Converting Yellow tones
          if ((R &gt; Color.Yellow.R - 110)
                  &amp;&amp; (G &gt; Color.Yellow.G - 110)
                  &amp;&amp; (B &lt; Color.Yellow.B + 110))
          {
              bmp.SetPixel(i, j, Color.Orange);
              continue;
          }
  
          // Converting White tones
          if ((R &gt; Color.White.R - 110)
              &amp;&amp; (G &gt; Color.White.G - 110)
              &amp;&amp; (B &gt; Color.White.B - 110))
          {
              bmp.SetPixel(i, j, Color.Orange);
              continue;
          }
  
          bmp.SetPixel(i, j, Color.Orchid);
      }
  }
  
  bmp.Save(@"FilteredCaptcha.bmp");
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>After running this code, the saved output (Bitmap) actually have more than the two colors i defined in code (which are "Orange" for characters and "Orchid" for everything else, in this sample).</p>
  
  <p>Once i "Zoom In" using Windows Explorer / <a href="http://www.gimp.org/" rel="nofollow noreferrer">Gimp</a> / <a href="http://www.aforgenet.com/projects/iplab/downloads.html" rel="nofollow noreferrer">ImageProcessingLab</a> , there are "tones" of orange and "tones" of orchid.</p>
  
  <p><strong>What am i missing here ? Why aren't the outputs binarized if the only uses "two" colors, instead of "tones" to Set the pixel Colors ?</strong></p>
  
  <p>I uploaded some images to make your inspection job easier.</p>
  
  <p>Input Bitmap:</p>
  
  <p><img src="https://i.imgur.com/at8VA.jpg" alt="Input Bitmap"></p>
  
  <p>Output Bitmap:</p>
  
  <p><img src="https://i.imgur.com/Sndku.jpg" alt="Output Bitmap"></p>