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)
评论列表
文章目录