diff --git a/qlprint/__main__.py b/qlprint/__main__.py index bf77b28..69c53c4 100644 --- a/qlprint/__main__.py +++ b/qlprint/__main__.py @@ -12,7 +12,7 @@ def create_parser(): epilog="Have fun printing!") parser.add_argument("image", type=str, help="path to image (with extension, i.e. .png) or name of temporary folder to continue printing part way through a failed print job (this would be a random string of 10 letters or numbers, e.g. oet845cgx9)") parser.add_argument("-n", "--copies", type=int, default=1, help="number of copies of the image/images to be printed") - parser.add_argument("-c", "--crop", type=bool, default=True, help="crop the whitespace out of an image") + parser.add_argument("-d", "--dontcrop", action=argparse.BooleanOptionalAction, help="to prevent cropping the whitespace out of an image") parser.add_argument("-t", "--test", type=bool, default=False, help="run program without printing") return parser @@ -29,8 +29,11 @@ def qlprint(): os.mkdir(path) filename = f"{path}/{name}.png" print("Converting images") - if args.crop: - task = subprocess.Popen(["magick", "-density", "300", args.image, "-trim" if args.crop else "", "-resize", "696x", filename]) + if args.dontcrop: + process = ["magick", "-density", "300", args.image, "-resize", "696x", filename] + else: + process = ["magick", "-density", "300", args.image, "-trim", "-resize", "696x", filename] + task = subprocess.Popen(process) task.wait() do_print = True else: