diff --git a/convert.py b/convert.py index 830059c..ced1fdc 100644 --- a/convert.py +++ b/convert.py @@ -13,8 +13,10 @@ import screen as screen_py # TODO: -# - only lookahead for 560px +# - support 140px mode again # - compare to bmp2dhr and a2bestpix +# - support LR/DLR +# - support HGR def main(): @@ -30,6 +32,12 @@ def main(): '--dither', type=str, choices=list(dither_pattern.PATTERNS.keys()), default=dither_pattern.DEFAULT_PATTERN, help="Error distribution pattern to apply when dithering.") + parser.add_argument( + '--show_input', action=argparse.BooleanOptionalAction, default=False, + help="Whether to show the input image before conversion.") + parser.add_argument( + '--show_output', action=argparse.BooleanOptionalAction, default=True, + help="Whether to show the output image after conversion.") args = parser.parse_args() palette = palette_py.Palette() @@ -37,7 +45,8 @@ def main(): screen = screen_py.DHGR560Screen(palette) image = image_py.open(screen.X_RES, screen.Y_RES, args.input) - # image_rgb.show() + if args.show_input: + Image.fromarray(image.astype(np.uint8)).show() dither = dither_pattern.PATTERNS[args.dither]() @@ -51,7 +60,8 @@ def main(): np.uint8)) outfile = os.path.join(os.path.splitext(args.output)[0] + ".png") out_image.save(outfile, "PNG") - out_image.show(title=outfile) + if args.show_output: + out_image.show() # bitmap = Image.fromarray(screen.bitmap.astype('uint8') * 255) with open(args.output, "wb") as f: