twolfson / spritesmith

Utility that takes sprites and converts them into a stylesheet and its coordinates
MIT License
914 stars 56 forks source link

Add a margin option #81

Closed Juankz closed 4 years ago

Juankz commented 4 years ago

White space between the sprites and the image borders helps avoid some scaling artifacts.

twolfson commented 4 years ago

This feature is available via the padding option in processImages:

https://github.com/twolfson/spritesmith/tree/3.4.0#spritesheetprocessimagesimages-options

Here's an example usage:

https://github.com/twolfson/spritesmith/tree/3.4.0#padding

If you're using our Grunt or gulp variants, then it's padding in the params object:

https://github.com/twolfson/gulp.spritesmith/tree/6.11.0#spritesmithparams

https://github.com/twolfson/grunt-spritesmith/tree/6.8.0#documentation

Juankz commented 4 years ago

Hi, thanks for answering. If I'm not mistaken, padding give this result (yellow = padding): current

But I'm looking for this (green = margin): desired

twolfson commented 4 years ago

I see. Can you explain your use case further? I know padding between images is good for artifacts based on past issues (https://github.com/twolfson/spritesmith/issues/7) but haven't heard about margin having that effect

Juankz commented 4 years ago

I guess it could be considered an edge case, so far it's most noticeable with text on certain typographies, when scaling there are some filter artifacts due to chrome's scaling filter. explanation

twolfson commented 4 years ago

Ahh, very interesting. Hmm, would you be okay with a workaround instead of a formal library solution? I'm skeptical it's worth addressing since nobody has asked about it the 8 years this library has been around o_o

Workaround options:

On Thu, Jul 23, 2020, 9:27 AM Juan Carlos notifications@github.com wrote:

I guess it could be considered an edge case, so far it's most noticeable with text on certain typographies, when scaling there are some filter artifacts due to chrome's scaling filter. [image: explanation] https://user-images.githubusercontent.com/18577412/88311864-0ad53000-ccd7-11ea-8b6a-badc9c304b29.png

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/twolfson/spritesmith/issues/81#issuecomment-663103998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG4KWB7TII37VRHFVCZHF3R5BQF7ANCNFSM4PFYVKHA .

Juankz commented 4 years ago

Yeah, no problem, I've also thought about other ways to solve this issue. Thanks for your time

twolfson commented 4 years ago

Cool, yea =/ Thanks for understanding =) If more people write in about it, then we'll gladly revisit =)

And still glad to help you work through any of those workarounds =)

On Thu, Jul 23, 2020, 9:54 AM Juan Carlos notifications@github.com wrote:

Yeah, no problem, I've also thought about other ways to solve this issue. Thanks for your time

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/twolfson/spritesmith/issues/81#issuecomment-663117509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG4KWGN2VCFHXLMBGAS2BTR5BTNFANCNFSM4PFYVKHA .