title: exception floating parameter is not finite canvas
body: <p>I wrote this code but I have a problem in line 18</p>
  
  <pre><code>    var c=document.getElementById("viewport");
      var ctx=c.getContext("2d");
      var imgData= new Image();
      imgData.src = "q.jpg";
      var length = imgData.length;
      var width = imgData.width;
      var img=ctx.createImageData(length,width);
      imgData.onload = function(){
          for (var i=0;i&lt;length;i+=4)
              {
                 .
                 .
                 .
                  }
                  imgData.data[i+3]=255;  //alpha
              }
          ctx.putImageData(img,10,10);
      };
      console.log(img .toString());
  </code></pre>
  
  <p>at This particular line</p>
  
  <pre><code>var img=ctx.createImageData(length,width);
  </code></pre>
  
  <p>this is the exception that i get : <strong>floating parameter is not finite</strong> .</p>