diff options
author | jaseg <jaseg@jaseg.net> | 2014-01-12 19:07:12 +0100 |
---|---|---|
committer | jaseg <jaseg@jaseg.net> | 2014-01-12 19:07:12 +0100 |
commit | 36068c3d475384aa427646e54229ddfde7d14aaf (patch) | |
tree | 63752c16baece212da3abe7466deff49b67a91fe | |
parent | 2fb648b3d616494a34351eeee4d2ed544c2b793d (diff) | |
download | pixelterm-36068c3d475384aa427646e54229ddfde7d14aaf.tar.gz pixelterm-36068c3d475384aa427646e54229ddfde7d14aaf.tar.bz2 pixelterm-36068c3d475384aa427646e54229ddfde7d14aaf.zip |
Import fixes and a small terminal size handling fix
-rwxr-xr-x | pixelterm/gifterm.py | 10 | ||||
-rwxr-xr-x | pixelterm/pixelterm.py | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/pixelterm/gifterm.py b/pixelterm/gifterm.py index 0ebded1..e3563f3 100755 --- a/pixelterm/gifterm.py +++ b/pixelterm/gifterm.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import os, sys, argparse, os.path, json, time, signal, atexit -from pixelterm import pixelterm +import pixelterm from PIL import Image, GifImagePlugin, ImageSequence clear_screen = '\033[H\033[2J' @@ -18,7 +18,10 @@ def main(): if args.size: tw, th = map(int, args.size.split('x')) else: - tw, th = os.get_terminal_size() + try: + tw, th = os.get_terminal_size() + except: # If this is not a regular terminal + pass th = th*2 img = Image.open(args.image) @@ -38,7 +41,8 @@ def main(): last_frame = c im = last_frame.copy() - im.thumbnail((tw, th), Image.NEAREST) + if (tw, th) != (None, None): + im.thumbnail((tw, th), Image.NEAREST) frames.append(pixelterm.termify_pixels(im)) print(cursor_invisible) diff --git a/pixelterm/pixelterm.py b/pixelterm/pixelterm.py index dccd788..30af163 100755 --- a/pixelterm/pixelterm.py +++ b/pixelterm/pixelterm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from pixelterm import xtermcolors +import xtermcolors reset_sequence = '\033[39;49m' |