spritesheet-js-monkiki-fork v0.7.1-b
Spritesheet.js is command-line spritesheet (a.k.a. Texture Atlas) generator written in node.js.
==============
Fork objective
This version rectifies the problem with its use in PIXI.js where packing assets together and sub-pixel rendering creates artefacts around the assets, especially in tiled textures.
Avoiding this issue with the following:
- create 2px (or otherwise specified) gap between each image
recalculate the coordinate with the extra 2px at top, bottom, left, right
============== ###Supported spritesheet formats###
- Starling / Sparrow
- JSON (i.e. PIXI.js)
- Easel.js
- cocos2d (experimental)
###Usage### 1. Command Line
```bash
$ spritesheet-js assets/*.png
```
Options:
```bash
$ spritesheet-js
Usage: spritesheet-js [options] <files>
Options:
-f, --format format of spritesheet (starling, sparrow, json, pixi.js, easel.js, cocos2d) [default: "json"]
-n, --name name of generated spritesheet [default: "spritesheet"]
-p, --path path to export directory [default: "."]
--trim removes transparent whitespaces around images [default: false]
--square texture should be s square [default: false]
--powerOfTwo texture width and height should be power of two [default: false]
--algorithm packing algorithm: growing-binpacking (default), binpacking (requires passing width and height options), vertical or horizontal [default: "growing-binpacking"]
--gap2px add 2 px gap around each texture and readjust the coordinates, so each texture are not touching eachother. [default: false]
```
Node.js
var spritesheet = require('spritesheet-js'); spritesheet('assets/*.png', {format: 'json'}, function (err) { if (err) throw err; console.log('spritesheet successfully generated'); });
###Trimming / Cropping### Spritesheet.js can remove transparent whitespace around images. Thanks to that you can pack more assets into one spritesheet and it makes rendering a little bit faster.
NOTE: Some libraries such as Easel.js or PIXI.js dont't support this feature.
###Installation###
1. Install ImageMagick
2. npm install spritesheet-js -g
###Test###
mocha test
Thanks Przemysław Piekarski for logo design and assets in examples.