8bitlenser/lenser/sms/convert/mono.py
2026-07-03 19:35:35 -07:00

21 lines
823 B
Python

"""SMS monochrome: 256x192 using the VDP's 4 true greys (2-bit per channel),
tone carried by dithering."""
from __future__ import annotations
from ...convert.base import Conversion
from . import _common
WIDTH, HEIGHT = 256, 192
PIXEL_ASPECT = 1.0
def convert(img_rgb, palette_name="sms", dither_mode="floyd",
intensive=False, base_color=None):
pat, nt, pal, preview, err = _common.encode(img_rgb, dither_mode, mono=True,
base_color=base_color)
return Conversion(
mode="mono", width=WIDTH, height=HEIGHT, pixel_aspect=PIXEL_ASPECT,
index_image=None, data={"patterns": pat, "nametable": nt, "palette": pal},
data_addr=0, viewer="sms", preview_rgb=preview, error=err,
meta={"palette": "sms", "dither": dither_mode},
)