Skip to content

Turn pictures into sprites with a no-AI subject finder - #37

Merged
Finesssee merged 2 commits into
mainfrom
ts/autosprite
Oct 14, 2026
Merged

Finesssee merged 2 commits into
mainfrom
ts/autosprite

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Viewers who make their own sprite on the fighter page ("Your own sprite") get a cleaner cut-out without any AI call.

What changes

  • New src/autosprite.ts finds the subject: border background colors, geodesic saliency, a body prior for busts, and a graph cut. A picture with no clear subject (a landscape, two animals side by side) keeps the whole picture instead of a random piece. A blank picture still gives nothing.
  • src/spritify.ts keeps its API. Shrinking now uses a k-means Oklab palette (14 colors), weighted cell votes so thin dark lines and eyes survive, a lone-pixel cleanup, and an outline in a dark shade of each border color.
  • Removed palette, quantize, outline and OUTLINE (no callers outside the tests).

Checked

  • bun run check: 391 of 391 pass. tests/spritify.test.ts covers a scene keeping the whole picture, the shaded outline literals and the existing cut-out and size cases.
  • Bench on seven real pictures (cartoon bust, emote sheet, three duck busts, landscape, lion and cat): 150 to 560 ms each in Node.

Limits

  • It runs on the main thread, so the page pauses for up to about 0.5 s while a big picture converts. A worker could follow.

src/autosprite.ts finds the subject (border background clusters, geodesic
saliency, a bust body prior and a graph cut). A picture with no clear subject,
such as a landscape, keeps all of it. spritify now shrinks with an Oklab
k-means palette, cleans lone pixels and draws a shaded outline.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: nesszer/pixfray/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 442954ed-b51c-4628-86df-f123166efd7a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit 84edc2f into main Oct 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant