import png
import numpy

s = ['110010010011',
     '101011010100',
     '110010110101',
     '100010010011']

s = map(lambda x: map(int, x), s)

palette = [(0x55,0x55,0x55), (0xff,0x99,0x99)]
palette_np = numpy.array(palette) # creates a 2x3 array

w = png.Writer(len(s[0]), len(s), palette=palette, bitdepth=1) # this works
w = png.Writer(len(s[0]), len(s), palette=palette_np, bitdepth=1) # this fails
