title: Floyd Steinberg Dithering gray(pgm ascii) to black-white (pbm ascii)
body: <p>I have image in pgm </p>
  
  <p><img src="https://i.stack.imgur.com/0XSG9.jpg" alt="enter image description here"></p>
  
  <p>after using this function:</p>
  
  <pre><code>void convertWithDithering(array_type&amp; pixelgray)
  {
  
      int oldpixel;
      int newpixel;
      int quant_error;
  
      for (int y = 0; y&lt; HEIGHT-1; y++){
          for (int x = 1; x&lt;WIDTH-1; x++){
                  oldpixel = pixelgray[x][y];
                   newpixel  = (oldpixel &gt; 128) ? 0 : 1;
                   pixelgray[x][y] = newpixel;
                    quant_error  = oldpixel - newpixel;
                   pixelgray[x+1][y]  =  pixelgray[x+1][y] + 7/16 * quant_error;
                  pixelgray[x-1][y+1]  = pixelgray[x-1][y+1] + 3/16 * quant_error;
                  pixelgray[x  ][y+1]=pixelgray[x  ][y+1]+  5/16 * quant_error;
                   pixelgray[x+1][y+1] = pixelgray[x+1][y+1]+ 1/16 * quant_error;
          }
      }
  
  }
  </code></pre>
  
  <p>i have this </p>
  
  <p><img src="https://i.stack.imgur.com/3YJ0R.jpg" alt="enter image description here"></p>
  
  <p>I want to get the same image only in black white colors</p>