From 7878aa1d455ab24d0336fc68eb09f726bcba10b2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 4 Mar 2014 01:07:22 +0100 Subject: Now faster. And with more Jenny Holzer. --- host/terminal.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 host/terminal.py (limited to 'host/terminal.py') diff --git a/host/terminal.py b/host/terminal.py new file mode 100644 index 0000000..86b4db1 --- /dev/null +++ b/host/terminal.py @@ -0,0 +1,19 @@ +from pixelterm.pixelterm import termify_pixels + +class MockImage: + def __init__(self, nparray): + self.nparray = nparray + self.im = self + + @property + def size(self): + h, w, _ = self.nparray.shape + return (w, h) + + def getpixel(self, pos): + x, y = pos + return tuple(self.nparray[y][x]) + +def printframe(framedata): + print(termify_pixels(MockImage(framedata))) + -- cgit