diff --git a/convert_dhr.py b/convert_dhr.py index 9ba7801..4e95eb8 100644 --- a/convert_dhr.py +++ b/convert_dhr.py @@ -10,15 +10,15 @@ import screen as screen_py import image as image_py -def _output(out_image: Image, args): - if args.show_output: +def _output(out_image: Image, args): + if args.show_output: out_image.show() - if args.save_preview: - # Save Double hi-res image - outfile = os.path.join( - os.path.splitext(args.output)[0] + "-preview.png") - out_image.save(outfile, "PNG") + if args.save_preview: + # Save Double hi-res image + outfile = os.path.join( + os.path.splitext(args.output)[0] + "-preview.png") + out_image.save(outfile, "PNG") def _write(screen: screen_py.DHGRScreen, bitmap: np.ndarray, args): @@ -57,6 +57,7 @@ def convert(screen: screen_py.DHGRNTSCScreen, image: Image, args): _output(out_image, args) _write(screen, bitmap, args) + def convert_mono(screen: screen_py.DHGRScreen, image: Image, args): image = image.convert("1") diff --git a/image.py b/image.py index 622b61b..40a8bc3 100644 --- a/image.py +++ b/image.py @@ -46,5 +46,6 @@ def resize( else: return res + def resize_mono(image: Image, x_res, y_res) -> Image: return image.resize((x_res, y_res), Image.LANCZOS) diff --git a/screen.py b/screen.py index 681bbcc..32108ca 100644 --- a/screen.py +++ b/screen.py @@ -1,6 +1,5 @@ """Representation of Apple II screen memory.""" -import math import numpy as np import palette as palette_py @@ -111,6 +110,7 @@ class DHGRScreen: self.main[addr:addr + 40] = main_col[y, :] return + class DHGRNTSCScreen(DHGRScreen): def __init__(self, palette: palette_py.Palette): self.palette = palette