title: putImageData doesn't show image
body: <p>I use the following function to update the contents of a canvas element, where frame_data is an array of <code>width*height*3</code>.</p>
  
  <pre><code>function updateCanvas(frame_data, width, height) {
      img = ctx.createImageData(width, height);
  
      for (i=0, j=0; j &lt; frame_data.length; i++) {
          if ((i &gt; 0) &amp;&amp; (i%3==0)) {
              img.data[i] = 255;
          } else {
              img.data[i] = frame_data[j++];
          }
      }
      ctx.putImageData(img, 0, 0);
  }`
  </code></pre>
  
  <p>It doesn't seem to work on Chrome 8, since I am getting this image as a result:</p>
  
  <p><img src="https://i.stack.imgur.com/HwZSf.png" alt="enter image description here"></p>
  
  <p>I've checked the <code>img.data</code> array produced by this function and the data are correct. So I assume that the problem is with the <code>putImageData</code> function. Has anyone else encountered the same problem? What could be wrong?</p>