aslansky / css-sprite

css sprite generator
MIT License
733 stars 55 forks source link

Allow binary-tree packing as an option #13

Closed hisnameisjimmy closed 10 years ago

hisnameisjimmy commented 10 years ago

This is a formal request for binary-tree packing. Right now this plugin only generates vertical and horizontally packed sprites, which when generating retina images can run into issues with overall texture size. If the sprite map is too large, iOS will either downscale or not render the sprites.

However, with binary tree packing, you could allow the sprites to take up the smallest overall area. Spritesmith does this well, but their tool makes generating retina sprites much more of a hassle. With css-sprite, I can just watch an image directory with gulp, and when something is added the sprite and relevant css is updated without any intervention on my part. It's a beautiful plugin, if only it could do binary-tree packing.

You can see an example of the image size problem on iOS here: http://weedygarden.net/demos/hi-res-retina-sprites/ and an explanation of the size issues here: http://weedygarden.net/2012/04/hi-res-retina-display-css-sprites/

A bin-packing algorithm that may be useful: https://github.com/jakesgordon/bin-packing

vomchik commented 10 years ago

@hisnameisjimmy I think will better use this module for packing images https://www.npmjs.org/package/layout

hisnameisjimmy commented 10 years ago

I'm totally cool with whatever gets the job done. This is a great plugin and I love it, but bin packing would be amazing.

aslansky commented 10 years ago

The layout package looks great. I will look into integrating layouts in the next days.

hisnameisjimmy commented 10 years ago

Awesome! Great to hear.

hisnameisjimmy commented 10 years ago

Any word on integrating bin packing?

kdietrich commented 10 years ago

Any news here? Binary tree packing would be a really great enhancement.

aslansky commented 10 years ago

Hey, sorry I was on vacation the last weeks and now I am filled up with work. But I try to get on it as soon as possible.

hisnameisjimmy commented 10 years ago

No worries, excited to use it when it comes out!