Created
October 31, 2011 13:48
-
-
Save ralphbean/1327533 to your computer and use it in GitHub Desktop.
ansi2html test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
The great test for ansi2html. Can it reliably reproduce images that have been | |
converted to ansi color by fabulous? | |
Before running this, install the following in a virtualenv:: | |
$ pip install ansi2html fabulous PIL | |
Author: Ralph Bean -- http://threebean.org | |
""" | |
import ansi2html | |
import fabulous.image | |
import tempfile | |
import urllib | |
if __name__ == '__main__': | |
fname = tempfile.mkstemp(prefix='lime')[1] | |
urllib.urlretrieve("http://threebean.org/lime.jpg", fname) | |
img = fabulous.image.Image(fname, width=160) | |
html = ansi2html.Ansi2HTMLConverter().convert(str(img)) | |
print html | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment