First public commit.
This commit is contained in:
parent
2a48f52979
commit
4bac9d83ed
288 changed files with 18417 additions and 1076 deletions
25
lenser/iigs/convert/mono.py
Normal file
25
lenser/iigs/convert/mono.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""Apple IIGS SHR monochrome: 320x200 with a single 16-level grey palette (the
|
||||
richest greyscale in lenser). ``--mono-base`` tints the ramp toward a colour."""
|
||||
from __future__ import annotations
|
||||
|
||||
from ...convert.base import Conversion
|
||||
from ...palette import get_palette
|
||||
from . import _common
|
||||
|
||||
WIDTH, HEIGHT = 320, 200
|
||||
PIXEL_ASPECT = 1.0
|
||||
|
||||
|
||||
def convert(img_rgb, palette_name="iigs", dither_mode="floyd",
|
||||
intensive=False, base_color=None):
|
||||
base_rgb = None
|
||||
if isinstance(base_color, int) and 0 <= base_color < 16:
|
||||
base_rgb = get_palette("colodore")[base_color] # tint hue from C64 pal
|
||||
block, preview, err = _common.encode(img_rgb, dither_mode, mono=True,
|
||||
base_color=base_rgb)
|
||||
return Conversion(
|
||||
mode="mono", width=WIDTH, height=HEIGHT, pixel_aspect=PIXEL_ASPECT,
|
||||
index_image=None, data=block, data_addr=0x2000, viewer="iigs",
|
||||
preview_rgb=preview, error=err,
|
||||
meta={"palette": "iigs", "dither": dither_mode},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue