From 8d3ab4f50e44d70fa3f5359bb2603535c63bbe05 Mon Sep 17 00:00:00 2001 From: kris Date: Wed, 24 Nov 2021 15:41:32 +0000 Subject: [PATCH] Add the ability to disable saving preview images. Also rename --gamma_correct to --gamma-correct for consistency --- convert.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/convert.py b/convert.py index 6eac012..60e6d45 100644 --- a/convert.py +++ b/convert.py @@ -323,13 +323,17 @@ def main(): '--verbose', action=argparse.BooleanOptionalAction, default=False, help="Show progress during conversion") parser.add_argument( - '--gamma_correct', type=float, default=2.4, + '--gamma-correct', type=float, default=2.4, help='Gamma-correct image by this value (default: 2.4)' ) parser.add_argument( - '--fixed_colours', type=int, default=0, + '--fixed-colours', type=int, default=0, help='How many colours to fix as identical across all 16 SHR palettes' ) + parser.add_argument( + '--save-preview', type=bool, default=True, + help='Whether to save a .PNG rendering of the output image' + ) args = parser.parse_args() if args.lookahead < 1: parser.error('--lookahead must be at least 1') @@ -424,10 +428,12 @@ def main(): print("%d unique colours" % unique_colours) seq += 1 - # Save Double hi-res image - outfile = os.path.join( - os.path.splitext(args.output)[0] + "-%d-preview.png" % seq) - out_image.save(outfile, "PNG") + + if args.save_preview: + # Save Double hi-res image + outfile = os.path.join( + os.path.splitext(args.output)[0] + "-%d-preview.png" % seq) + out_image.save(outfile, "PNG") screen.pack() # with open(args.output, "wb") as f: # f.write(bytes(screen.aux))