i = i.resize((width, height), Image.ANTIALIAS)
height = min(height, c['IMAGE_MAX_HEIGHT'])
- for y in xrange(height):
+ for y in range(height):
sys.stdout.write(' ' * start)
- for x in xrange(width):
+ for x in range(width):
p = i.getpixel((x, y))
r, g, b = p[:3]
pixel_print(rgb2short(r, g, b))
for mu in media_url:
try:
response = requests.get(mu)
- image_to_display(StringIO(response.content))
- except:
+ image_to_display(BytesIO(response.content))
+ except Exception:
printNicely(red('Sorry, image link is broken'))
if iot:
try:
response = requests.get(profile_image_url)
- image_to_display(StringIO(response.content), 2, 20)
+ image_to_display(BytesIO(response.content), 2, 20)
except:
pass
else:
# StringIO module
try:
- from StringIO import StringIO
+ from StringIO import StringIO, BytesIO
except:
- from io import StringIO
+ from io import StringIO, BytesIO
# raw_input and map functiion behaviour
if sys.version[0]=="3":