"""Commodore VIC-20 conversion dispatch.""" from __future__ import annotations from ... import imageprep from . import hires, mono, multicolor _MODULES = {"multicolor": multicolor, "hires": hires, "mono": mono} MODES = list(_MODULES.keys()) def convert_image(path_or_img, mode="multicolor", palette_name="vic", dither_mode="floyd", intensive=False, prep_opt=None, base_color=None): mod = _MODULES.get(mode, multicolor) prep_opt = prep_opt or imageprep.PrepOptions() img_rgb = imageprep.prepare(path_or_img, mod.WIDTH, mod.HEIGHT, mod.PIXEL_ASPECT, prep_opt, border_rgb=(0, 0, 0)) return mod.convert(img_rgb, palette_name, dither_mode, intensive, base_color=base_color)