fix docs
[rainbowstream.git] / rainbowstream / c_image.py
index 7b334894530f801bfb4c99023e95595e0acb29bf..e440d405e509b66ba0e4264ddff597e310cd32ec 100644 (file)
@@ -24,7 +24,7 @@ def pixel_print(ansicolor):
     sys.stdout.write('\033[48;5;%sm \033[0m' % (ansicolor))
 
 
-def image_to_display(path,start=None,length=None):
+def image_to_display(path, start=None, length=None):
     rows, columns = os.popen('stty size', 'r').read().split()
     if not start:
         start = c['IMAGE_SHIFT']
@@ -40,13 +40,13 @@ def image_to_display(path,start=None,length=None):
     i = i.resize((width, height), Image.ANTIALIAS)
     height = min(height, c['IMAGE_MAX_HEIGHT'])
 
-    for y in xrange(height):
-        print ' ' * start,
-        for x in xrange(width):
+    for y in range(height):
+        sys.stdout.write(' ' * start)
+        for x in range(width):
             p = i.getpixel((x, y))
             r, g, b = p[:3]
             pixel_print(rgb2short(r, g, b))
-        print ''
+        sys.stdout.write('\n')
 
 if __name__ == '__main__':
     image_to_display(sys.argv[1])