8bitlenser/lenser/amiga/convert/lowres.py
2026-07-03 19:35:35 -07:00

21 lines
765 B
Python

"""Amiga low resolution: 320x200, 32 colours from the 4096-colour palette."""
from __future__ import annotations
from ...convert.base import Conversion
from . import _common
WIDTH, HEIGHT = 320, 200
PIXEL_ASPECT = 1.0
NCOL = 32
def convert(img_rgb, palette_name="amiga", dither_mode="floyd",
intensive=False, base_color=None):
planes, colors, preview, err = _common.flat_encode(img_rgb, NCOL, dither_mode)
return Conversion(
mode="lowres", width=WIDTH, height=HEIGHT, pixel_aspect=PIXEL_ASPECT,
index_image=None,
data={"planes": planes, "colors": colors, "nplanes": 5, "ham": False},
data_addr=0, viewer="amiga", preview_rgb=preview, error=err,
meta={"palette": "amiga", "dither": dither_mode},
)