19 lines
771 B
Python
19 lines
771 B
Python
"""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},
|
|
)
|