First public commit.

This commit is contained in:
The Dust Council 2026-07-03 19:35:35 -07:00
parent 2a48f52979
commit 4bac9d83ed
288 changed files with 18417 additions and 1076 deletions

19
lenser/sms/convert/bg.py Normal file
View file

@ -0,0 +1,19 @@
"""SMS background image: 256x192, 2 palettes of 16 (of 64), <=512 tiles."""
from __future__ import annotations
from ...convert.base import Conversion
from . import _common
WIDTH, HEIGHT = 256, 192
PIXEL_ASPECT = 1.0 # 256x192 is exactly 4:3 -> square pixels
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=False)
return Conversion(
mode="bg", 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},
)