Skip to content

Instantly share code, notes, and snippets.

@Katharine
Created March 11, 2015 19:13
Show Gist options
  • Save Katharine/eefb914501314aed1fe6 to your computer and use it in GitHub Desktop.
Save Katharine/eefb914501314aed1fe6 to your computer and use it in GitHub Desktop.
In [1]: pixels = []
In [2]: colours = (0, 85, 170, 255)
In [3]: for r in colours:
...: for g in colours:
...: for b in colours:
...: pixels.append((r, g, b))
...:
In [4]: len(pixels)
Out[4]: 64
In [5]: import png
In [6]: p = png.from_array(pixels, 'RGB;8')
In [7]: p.save('foo.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment