@yearbook2026/converter
v0.1.0
Published
image → job.json for YEARBOOK 2026 (palette snap + optional dithering)
Readme
@yearbook2026/converter
Image → job.json for YEARBOOK 2026: snap RGBA
pixels to the locked 32-colour palette (r/place 2022), optionally dither, and emit the
job format every kit tool consumes (07-AGENT-KIT §1).
import { toJob, validateJob } from '@yearbook2026/converter';
// image: { width, height, data } — RGBA bytes, e.g. from a <canvas> or a PNG decoder
const job = toJob(image, { x: 120, y: 88, name: 'my-logo' });
// → { yearbook: "2026", version: 1, pixels: [{ x, y, c }, …] }
const parsed = validateJob(JSON.parse(fs.readFileSync('job.json', 'utf8')));
if (!parsed.ok) throw new Error(parsed.reason);- Transparent pixels are skipped; so are blank-white ones by default (
skipBlank) — painting a pixel the colour it already is still costs money. - Pixels that would land off-canvas are dropped, not clamped.
snapToPalette/nearestIndexare exported separately if you only want the colour-mapping step.
Part of yearbook-kit — the open-source half of YEARBOOK 2026. MIT.
