twolfson / gulp.spritesmith

Convert a set of images into a spritesheet and CSS variables via gulp
The Unlicense
1.08k stars 81 forks source link

maximum horizontal and vertical values of each image... #153

Closed WiSangUk closed 3 years ago

WiSangUk commented 3 years ago

This is a question while using spriteSmith.

When creating a sprite, based on the maximum horizontal and vertical values of each image When creating a sprite, how do I make it the same horizontal and vertical size, and centered within that area?

For example:

(img) ■(1x1) + ■■■(3x1) + ■(1x3)           ■           ■

=(sprite) □□□ (area 3x3, img1x1) □■□ □□□ ---------- (padding) □□□ (area 3x3, img3x1) ■■■ □□□ ---------- (padding) □■□ (area 3x3, img1x3) □■□ □■□

twolfson commented 3 years ago

We don't have anything built-in for per-image padding but here's a few ways to accomplish this: