First public commit.
This commit is contained in:
parent
2a48f52979
commit
4bac9d83ed
288 changed files with 18417 additions and 1076 deletions
22
lenser/nes/convert/mono.py
Normal file
22
lenser/nes/convert/mono.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""NES monochrome: 256x240 greyscale using the PPU's grey ramp (tone by
|
||||
dithering). ``--mono-base`` tints the ramp toward a hue."""
|
||||
from __future__ import annotations
|
||||
|
||||
from ...convert.base import Conversion
|
||||
from . import _common
|
||||
|
||||
WIDTH, HEIGHT = 256, 240
|
||||
PIXEL_ASPECT = 1.0
|
||||
|
||||
|
||||
def convert(img_rgb, palette_name="nes", dither_mode="floyd",
|
||||
intensive=False, base_color=None):
|
||||
subs = _common.pick_subpalettes(img_rgb, mono=True, base_color=base_color)
|
||||
pal32, nt, chr_rom, idx, err, plab, prgb = _common.encode(
|
||||
img_rgb, dither_mode, subs)
|
||||
return Conversion(
|
||||
mode="mono", width=WIDTH, height=HEIGHT, pixel_aspect=PIXEL_ASPECT,
|
||||
index_image=idx, data={"palette": pal32, "nametable": nt, "chr": chr_rom},
|
||||
data_addr=0, viewer="nes", preview_rgb=prgb[idx], error=err,
|
||||
meta={"palette": "nes", "dither": dither_mode},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue