Repository navigation
Turn pictures into sprites with a no-AI subject finder - #37
Merged
Merged
Conversation
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.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Viewers who make their own sprite on the fighter page ("Your own sprite") get a cleaner cut-out without any AI call.
What changes
src/autosprite.tsfinds 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.tskeeps 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.palette,quantize,outlineandOUTLINE(no callers outside the tests).Checked
bun run check: 391 of 391 pass.tests/spritify.test.tscovers a scene keeping the whole picture, the shaded outline literals and the existing cut-out and size cases.Limits