19 lines
917 B
Python
19 lines
917 B
Python
"""Atari 2600 conversion dispatch."""
|
|
from __future__ import annotations
|
|
from ... import imageprep
|
|
from . import pf
|
|
|
|
# "pf" = flicker-free 3-colour/scanline; "pf_il" = temporal interlace (two
|
|
# frames at 60Hz blend to ~4-6 perceived colours/scanline, at the cost of flicker);
|
|
# "mono" = pf restricted to the TIA's greys (one hue's 8 luminances).
|
|
MODES = ["pf", "pf_il", "mono"]
|
|
|
|
|
|
def convert_image(path_or_img, mode="pf", palette_name="tia",
|
|
dither_mode="floyd", intensive=False, prep_opt=None, base_color=None):
|
|
prep_opt = prep_opt or imageprep.PrepOptions()
|
|
img_rgb = imageprep.prepare(path_or_img, pf.WIDTH, pf.HEIGHT,
|
|
pf.PIXEL_ASPECT, prep_opt, border_rgb=(0, 0, 0))
|
|
return pf.convert(img_rgb, palette_name, dither_mode, intensive,
|
|
base_color=base_color, interlace=(mode == "pf_il"),
|
|
gray=(mode == "mono"))
|