Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding support #76

Open
brandonjpierce opened this issue Nov 17, 2023 · 4 comments
Open

Padding support #76

brandonjpierce opened this issue Nov 17, 2023 · 4 comments

Comments

@brandonjpierce
Copy link

brandonjpierce commented Nov 17, 2023

First off, excellent library, it has worked really well for us! One small need we have is actually applying a 1-2px padding around each icon. While this can be done at the SVG asset level we found it is a little easier to blanket apply it at the time of spritesheet generation. Current thought is a --spacing=1 flag or similar that would apply padding around each asset for the defined value.

@flother
Copy link
Owner

flother commented Nov 29, 2023

I don't think this would be too difficult: once the SVG has been rasterised as a Pixmap, it could then be redrawn into a buffered Pixmap (buffered by the number of padding pixels required). But I'm wondering what need you have that can't be handled by the icon-padding property. Are you able to share more details about your use-case?

@brandonjpierce
Copy link
Author

Almost less of a use case and more of a workaround for poorly exported assets. We have found on occasion that Figma, depending on how the vector is constructed, will sometimes export a SVG somewhat poorly which can result in a sort of sub-pixeling effect. Having the ability to add a 1-2px spacing around each icons accommodates for that. When drawing sprites to webgl for instance if the sub-pixeling is occurring you will see icons "bleeding" into one another just slightly.

@flother
Copy link
Owner

flother commented Feb 26, 2024

Am I right to say that Spritesmith's padding option is exactly the sort of thing you're after? For example, padding: 2 means there will be a 2px gap to the right and bottom of each image in the spritesheet.

(Not saying you should switch to Spritesmith, just wondering if that's the functionality you want to duplicate.)

@brandonjpierce
Copy link
Author

@flother precisely!

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

No branches or pull requests

2 participants