drj11/pypng — pull request #37 by sean-duffy (2014-09-22 14:11:36+00:00)
Title: Support 3-dimensional iterators in from_array

This change allows 3-dimensional iterators to be used in the first argument to `png.from_array`.

For example, previously to draw a 4x4 black and red chequered pattern using a list, you would have to do this:

>>> a = [[0, 0, 0, 255, 0, 0], [255, 0, 0, 0, 0, 0]]
>>> png.from_array(a, 'RGB').save('check.png')

With this change, if you wish, you are able to instead add a third dimension, separating the pixels in the rows like so:

>>> a = [[[0, 0, 0], [255, 0, 0]], [[255, 0, 0], [0, 0, 0]]]
>>> png.from_array(a, 'RGB').save('check.png')