"""Mattel Intellivision conversion dispatch.""" from __future__ import annotations from ... import imageprep from . import mono, stic _MODULES = {"stic": stic, "mono": mono} MODES = list(_MODULES.keys()) def convert_image(path_or_img, mode="stic", palette_name="stic", dither_mode="floyd", intensive=False, prep_opt=None, base_color=None): prep_opt = prep_opt or imageprep.PrepOptions() module = _MODULES.get(mode, stic) img_rgb = imageprep.prepare(path_or_img, stic.WIDTH, stic.HEIGHT, stic.PIXEL_ASPECT, prep_opt, border_rgb=(0, 0, 0)) return module.convert(img_rgb, palette_name, dither_mode, intensive, base_color=base_color)