title: save result of ndarray to image
body: <p>I have an image I take a snippet of, I am trying to save the snippet to a file.</p>
  <ol>
  <li>get image using getPixels</li>
  <li>snip section of ndarray (my goal is the top left corner)</li>
  <li>save the ndarray a new image</li>
  </ol>
  <p>My code:</p>
  <pre><code>var getPixels = require(&quot;get-pixels&quot;);
  var fs = require(&quot;fs&quot;);
  var savePixels = require(&quot;save-pixels&quot;);
  
  let img='path_to_img_file'
  getPixels(img, &quot;image/jpeg&quot;, function (err, pixels) {
    if (err) {
      console.log(&quot;Bad image&quot;, err);
      return;
    }
  
    pixels = pixels.hi(50, 50, 50); //subset
    savePixels(pixels, &quot;png&quot;).pipe((p) =&gt;
      fs.createWriteStream(p, &quot;shot.png&quot;)
    ); 
  </code></pre>
  <p>My error:</p>
  <p><code>Unhandled error. ('No data provided')</code></p>