title: How to convert a picture in pure black and white in Rust
body: <p>I want to convert a picture in pure black and white(e.g. no grayscale) using <code>Image</code> crate, the result should be a picture with 0 and 255 RGB values.</p>
  
  <p>Following the <a href="https://crates.io/crates/image" rel="nofollow noreferrer">docs</a> i've wrote the following:</p>
  
  <pre class="lang-rust prettyprint-override"><code>let img = image::open("photo.jpg").unwrap(); // Load picture
  let gray_img = img.grayscale(); // Convert it
  
  // Access a random pixel value
  let px = gray_img.get_pixel(0,0);
  println!("{:?}", pixel.data); // Print RGB array
  </code></pre>
  
  <p>The problem here is that, whatever pixel i print, it gives me grayscale value.
  So, is there a function to convert an image in pure black and white? Something like <a href="https://pillow.readthedocs.io/en/3.1.x/index.html" rel="nofollow noreferrer">Pillow</a>'s convert function for Python?</p>