feat: add --res and --aspectratio flags for custom output dimensions#25
Open
hai-pilgrim wants to merge 1 commit into
Open
feat: add --res and --aspectratio flags for custom output dimensions#25hai-pilgrim wants to merge 1 commit into
hai-pilgrim wants to merge 1 commit into
Conversation
--res WxH forces the output to an exact pixel resolution using NEAREST resampling (pixel-art safe). --aspectratio W:H center-crops the output to the given aspect ratio. --res takes precedence when both are given. spritegrid input.png --res 32x32 -o sprite.png spritegrid input.png --aspectratio 4:3 -o cropped.png Includes 18 unit tests covering parsing, resizing, cropping, and edge cases (identity, centering, portrait/landscape). Closes marksverdhei#4 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
--res WxH— force the output to an exact resolution (e.g.32x32,16x24) using NEAREST resampling--aspectratio W:H— center-crop the output to a given aspect ratio (e.g.4:3,16:9)--restakes precedence when both flags are givenUsage
spritegrid input.png --res 32x32 -o sprite.png spritegrid input.png --aspectratio 4:3 -o cropped.png spritegrid input.png --res 64x48 --aspectratio 4:3 -o sprite.png # --res winsTest plan
uv run pytest)test_resolution.pycoversparse_aspect_ratio,apply_resolution,apply_aspect_ratioCloses #4
🤖 Generated with Claude Code