img2txt.py (libcaca-0.99.beta19) | : | img2txt.py (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
RMASK = 0x00ff0000 | RMASK = 0x00ff0000 | |||
GMASK = 0x0000ff00 | GMASK = 0x0000ff00 | |||
BMASK = 0x000000ff | BMASK = 0x000000ff | |||
AMASK = 0xff000000 | AMASK = 0xff000000 | |||
BPP = 32 | BPP = 32 | |||
DEPTH = 4 | DEPTH = 4 | |||
HELP_MSG = """\ | HELP_MSG = """\ | |||
Usage: %s [OPTIONS]... <IMAGE> | Usage: %s [OPTIONS]... <IMAGE> | |||
Convert IMAGE to any text based available format. | Convert IMAGE to any text based available format. | |||
Example: %s -w 80 -f ansi ./caca.png | Example: %s -W 80 -f ansi ./caca.png | |||
Options: | Options: | |||
-h, --help This help | -h, --help This help | |||
-v, --version Version of the program | -v, --version Version of the program | |||
-W, --width=WIDTH Width of resulting image | -W, --width=WIDTH Width of resulting image | |||
-H, --height=HEIGHT Height of resulting image | -H, --height=HEIGHT Height of resulting image | |||
-x, --font-width=WIDTH Width of output font | -x, --font-width=WIDTH Width of output font | |||
-y, --font-height=HEIGHT Height of output font | -y, --font-height=HEIGHT Height of output font | |||
-b, --brightness=BRIGHTNESS Brightness of resulting image | -b, --brightness=BRIGHTNESS Brightness of resulting image | |||
-c, --contrast=CONTRAST Contrast of resulting image | -c, --contrast=CONTRAST Contrast of resulting image | |||
skipping to change at line 227 | skipping to change at line 227 | |||
#set contrast | #set contrast | |||
if contrast: | if contrast: | |||
dit.set_contrast(contrast) | dit.set_contrast(contrast) | |||
#set charset | #set charset | |||
if charset: | if charset: | |||
dit.set_charset(charset) | dit.set_charset(charset) | |||
#create dither | #create dither | |||
dit.bitmap(cv, 0, 0, width, height, img.tostring()) | dit.bitmap(cv, 0, 0, width, height, str(img.tobytes())) | |||
#print export to screen | #print export to screen | |||
sys.stdout.write("%s" % cv.export_to_memory(exformat)) | sys.stdout.write("%s" % cv.export_to_memory(exformat)) | |||
if __name__ == "__main__": | if __name__ == "__main__": | |||
#Import PIL package | #Import PIL package | |||
try: | try: | |||
from PIL import Image | from PIL import Image | |||
except ImportError, err: | except ImportError, err: | |||
sys.stderr.write("You need to install PIL module !\n") | sys.stderr.write("You need to install PIL module !\n") | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |