21 lines
816 B
Python
21 lines
816 B
Python
"""Commodore 128 conversion dispatch (VDC 80-column)."""
|
|
from __future__ import annotations
|
|
|
|
from ... import imageprep
|
|
from . import mono
|
|
from . import color
|
|
from . import hicolor
|
|
|
|
_MODULES = {"mono": mono, "color": color, "hicolor": hicolor}
|
|
MODES = list(_MODULES.keys())
|
|
|
|
|
|
def convert_image(path_or_img, mode="mono", palette_name="vdc",
|
|
dither_mode="floyd", intensive=False, prep_opt=None,
|
|
base_color=None):
|
|
prep_opt = prep_opt or imageprep.PrepOptions()
|
|
module = _MODULES.get(mode, mono)
|
|
img_rgb = imageprep.prepare(path_or_img, module.WIDTH, module.HEIGHT,
|
|
module.PIXEL_ASPECT, prep_opt, border_rgb=(0, 0, 0))
|
|
return module.convert(img_rgb, palette_name, dither_mode, intensive,
|
|
base_color=base_color)
|