import sys clrenc = { "\033[0m" :'', "\033[1;30m":'', "\033[1;31m":'', "\033[1;32m":'', "\033[1;33m":'', "\033[1;34m":'', "\033[1;35m":'', "\033[1;36m":'', "\033[1;37m":'' } img = sys.stdin.read() for enc in clrenc: img = img.replace(enc, clrenc[enc]) html = """ Asciify

Asciify

%s
""" % img print html