title: create PNG image from sparse data
body: <p>I would like to store a PNG image in Python where the RGB values are given by the list</p>
  
  <pre class="lang-py prettyprint-override"><code>entries = [
      [1, 2, [255, 255, 0]],
      [1, 5, [255, 100, 0]],
      [2, 5, [0, 255, 110]],
      # ...
      ]
  </code></pre>
  
  <p>(row, column, RGB triple), together with a default value of <code>[255, 255, 255]</code> and the information about the total dimensions of the image.</p>
  
  <p>Using <a href="https://pillow.readthedocs.org/en/3.0.x/" rel="nofollow noreferrer">PIL</a>, I could of course translate <code>entries</code> into a dense <code>m</code>-by-<code>n</code>-by-<code>3</code> matrix, but that doesn't fit into memory; the matrix dimensions can be in the ten thousands.</p>
  
  <p>Is there another way to create a PNG image with the above information?</p>