Audit and gate generated art
import { auditStyle, evaluateAudit } from "pixelkiln"
const audit = await auditStyle(loaded, specs, "neon", lock)
const result = evaluateAudit(audit, {
maxDistance: 35,
minTransparency: 0.1,
maxColors: 128,
sigma: 1.5,
})
if (!result.safe) console.error(result.violations)
Audits evaluate every structural output separately. Missing and unreadable files make the result unsafe even when all measured assets pass. Standard non-interlaced greyscale, indexed, RGB, greyscale-alpha, and RGBA PNGs are normalized to RGBA before palette and transparency measurements.
Provider-neutral pixel refinement is also public. refineFrameSet accepts
ordered { role, path } sources and writes one atomic multi-output record:
import { refineAsset, refineFrameSet, checkQualityRecord } from "pixelkiln"
await refineAsset({
source: "candidates/mountain.png",
output: "art/mountain-native.png",
palette: ["#141b1e", "#23312a", "#709fcf", "#f1bb70"],
fixerPython: ".pixelkiln/pixelfixer/bin/python",
})
const quality = await checkQualityRecord("art/mountain-native.pixelkiln.json")
if (!quality.safe) console.error(quality.reasons)
await refineFrameSet({
sources: [
{ role: "frame-00", path: "raw/idle-00.png" },
{ role: "frame-01", path: "raw/idle-01.png" },
],
output: "art/idle.png",
fps: 12,
palette: ["#161321", "#49374f", "#c16c5b", "#f3d6b3"],
})
refineAsset reconstructs the native grid through a pinned Pixel Art Fixer
installation, applies the exact palette without dithering, audits the result,
and writes a managed refine artifact bundle. Human approval is a separate
approveQualityRecord call so automated generation cannot approve itself.
Manifest orchestration is public too:
import {
inspectQualityProfile,
refineQualityProfiles,
requireApprovedQualitySources,
} from "pixelkiln"
await refineQualityProfiles(specs, lock, {
fixerPython: ".pixelkiln/pixelfixer/bin/python",
})
const state = await inspectQualityProfile(specs[0], lock)
const approvedSources = await requireApprovedQualitySources(specs, lock)
Inspection is read-only. Batch refinement preserves current pending and approved
records unless force is explicit. requireApprovedQualitySources throws when
a selected profile is missing, stale, tied to another source, or not approved;
pass its result to packStyle as sourceOverrides.
For repository-wide image regression checks, snapshot and verify a portable baseline:
import {
checkQualityBaseline,
resolveQualityInputs,
snapshotQualityBaseline,
} from "pixelkiln"
const inputs = resolveQualityInputs([
{ id: "mountain", path: "../art/mountain-native.png" },
], "config/quality-inputs.json")
await snapshotQualityBaseline(inputs, "quality/pixelkiln.quality.json")
const regression = await checkQualityBaseline("quality/pixelkiln.quality.json")
if (!regression.safe) console.error(regression.cases)
measureImageQuality exposes the underlying PNG metrics. Baselines can also
bind a refinement record, which makes changed record bytes or stale source and
output hashes a hard failure. These APIs measure structural drift; they do not
replace the separate human review recorded by approveQualityRecord.