mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5101] [MERGED] feat(sprites): deterministic pixelize post-processing for AI-generated pixel art #6627
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6627
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5101
Author: @kolacheee
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @kolacheee
Base:
staging← Head:feat/5096-sprite-pixelize📝 Commits (4)
8d68d8afeat(sprites): deterministic pixelize post-processing route (#5096)7ec1ff0Merge branch 'staging' into feat/5096-sprite-pixelizec6b045dfix(sprites): harden pixelize against bad input and oversized derived height4ccb3dcfix(sprites): keep server resource failures out of the 400 path; test HTTP contract📊 Changes
5 files changed (+468 additions, -1 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
package.json(+2 -1)📝
packages/server/src/routes/sprites.routes.ts(+54 -0)➕
packages/server/src/services/image/pixelize.service.ts(+220 -0)➕
scripts/regressions/pixelize.regression.ts(+191 -0)📄 Description
Closes #5096
Why
Image models asked for pixel art return approximately pixel art — anti-aliased edges, off-grid pixels, soft alpha, drifting palettes. Nothing turned that probabilistic output into an asset that can sit beside authored pixel art. (The surrounding machinery already exists: strict sheet-layout prompt contracts, real
sharp.extract()slicing, provider-agnostic chroma-matte removal — this adds the missing deterministic final step, the enabler for a pixel Experience's AI art tier.)What changed (server-only, additive)
New
packages/server/src/services/image/pixelize.service.ts—pixelizeImage(input, options):targetHeightis omitted);#rrggbbramp (≤256 entries; channel-distance nearest, deliberately no perceptual weighting or dithering — determinism first);rgba(0,0,0,0)so identical shapes hash identically;tileableverdict;PixelizeInputErrorfor every validation failure.getSharp()loader.POST /api/sprites/pixelize(sprites.routes.ts): accepts a data-URL or raw base64 (reusing the router's existing reference-image normalizer), returns{ imageBase64, report }.PixelizeInputError→ 400; the sharp-unavailable case (Android/Termux without a native prebuild) → the documented 503 with the loader's actionable message, never a bare 500. Standalone like the cleanup routes so client-only capability packages can call it over REST.Encoder gotcha, found by the regression during development: sharp's
png()witheffort/qualityoptions implicitly enables palette encoding, which rewrites the RGB under fully-transparent pixels to an arbitrary shared palette entry — silently breaking the normalization guarantee.palette: falseis now explicit, with a comment and a regression assertion pinning it.New tracked lane
regression:pixelize(wired intoregression:sprites): byte determinism, ramp-only opaque pixels, strict binary alpha, normalized transparency, tileable/split seam verdicts, and typed rejections (oversized input, badtargetWidth, malformed palette entries).Validation
pnpm checkpnpm regression:sprites(includes the newregression:pixelize)pnpm version:check(rootpackage.jsondiff is scripts-only)Summary by CodeRabbit
New Features
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.