v0.4.0
What's changed
- Switch to crunch-rs rectangle-packing library
- Added
--minify-index-file
CLI flag to remove optional whitespace from the JSON-formatted index file
Full changelog: v0.3.0...v0.4.0
New rectangle-packing library
By chance I discovered Chevy Ray Johnston's crunch-rs rectangle-packing library. I experimented with it and found that it's faster than the previous library I was using, rectangle-pack, and it produces smaller spritesheets (total pixels and file size). From version 0.4.0, Spreet uses crunch-rs to pack sprites into spritesheets. Some benchmarks are below.
Change in total pixels
Map style | Spritezero pixels | Spreet (rectangle-pack) pixels | Spreet (crunch-rs) |
---|---|---|---|
osm-bright-gl-style | 208,810 | 150,540 (-28%) | 130,048 (-38%) |
openstreetmap-americana | 577,548 | 638,392 (+11%) | 389,640 (-33%) |
mapbox-gl-styles (basic) | 271,488 | 348,100 (+28%) | 258,064 (-5%) |
mapbox-gl-whaam-style | 90,944 | 69,696 (-23%) | 59,136 (-35%) |
Change in file size
Map style | Spritezero file size | Spreet (rectangle-pack) file size | Spreet (crunch-rs) file size |
---|---|---|---|
osm-bright-gl-style | 43,860 | 27,124 (-38%) | 25,962 (-41%) |
openstreetmap-americana | 140,401 | 82,462 (-41%) | 80,899 (-42%) |
mapbox-gl-styles (basic) | 76,383 | 43,961 (-42%) | 41,546 (-46%) |
mapbox-gl-whaam-style | 17,342 | 5,423 (-69%) | 5,341 (-69%) |