kai.pet...@gmail.com writes: > im.getdata() => sequence > Returns the contents of an image as a sequence object containing pixel > values. The sequence object is flattened, so that values for line one > follow directly after the values of line zero, and so on.
And this is a list of 1's and 0's, I guess for a bitonal picture? Anyway, the code I posted should be able to take in the sequence directly (lazily) without needing an intermediate list. If you change the outer list comprehension to a generator expression (i.e. in Python 2.x, replace the square brackets with parentheses) it will produce a lazy sequence at the output, that you can then process one line at a time or whatever. Also, on computers these days, a million element list isn't a big problem. What are you going to do with the output? That might also help people find suggestions. -- https://mail.python.org/mailman/listinfo/python-list