From fa787ab9e3ed5daae754c261424877e11aaa21c0 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 2 Apr 2013 02:25:55 +0200 Subject: Further optimizations. Now it is good enough for me. --- pixelterm.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pixelterm.py b/pixelterm.py index db6227e..3ee0d85 100755 --- a/pixelterm.py +++ b/pixelterm.py @@ -34,17 +34,14 @@ def termify_pixels(img): coltop = (0,0,0,0) if colbot[3] != 255: colbot = (0,0,0,0) - c = '▀' - te = fgescape - be = bgescape #Da magicks: ▀█▄ - if coltop == (0,0,0,0): - c,te,be = '▄',be,te + c,cf = '▀','█' + te,be = fgescape,bgescape + if coltop == (0,0,0,0) or coltop == bg or colbot == fg: + c,cf,te,be = '▄',' ',be,te if colbot == coltop: - c = ' ' - out += te(coltop) - out += be(colbot) - out += c + c,te,be = cf,te,te + out += te(coltop) + be(colbot) + c out += '\n' return out -- cgit