tcv.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:tcv 作者: whentze 项目源码 文件源码
def print_fitting(path):
    img      = Image.open(path)
    termsize = shutil.get_terminal_size((9001, 9001))
    if args.bilevel:
        scale    = min(1, termsize[0]/img.size[0], 2*(termsize[1]-2)/(img.size[1]))
        newsize  = (2*int(scale*img.size[0]), int(scale*img.size[1]))
        newimg   = img.convert("1").resize(newsize, Image.LANCZOS)
        print_image_bl(newimg)
    else:
        scale    = min(1, termsize[0]/img.size[0], 2*(termsize[1]-2)/(img.size[1]))
        newsize  = (int(scale*img.size[0]), int(scale*img.size[1]))
        newimg   = img.convert("RGBA").resize(newsize, Image.LANCZOS)
        print_image_tc(newimg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号