Changing crop to dontcrop for better default

This commit is contained in:
Becky Kennedy 2024-07-19 15:26:44 +02:00
parent 55f92cc8b6
commit 7050a154da

View File

@ -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: