0.1.7 • Published 3 years ago
texturepackerify v0.1.7
TexturePackerify
Command-line Texture Packer and Extractor.
Setup
- Install Node.js
- Install ImageMagick (check "Install legacy utilities" during installation.)
- Navigate to your project root and run:
$ npm install texturepackerifyBuild Atlases
Place images inside folders. Each folder will be packed to atlas:
src
├── atlas1
│ ├── img0.png
│ ├── img1.png
│ ├── ...
├── atlas2
│ ├── img12.png
│ ├── img13.png
│ ├── ...Create pack.js:
const texturepackerify = require("texturepackerify");
const config = {
url: "./src/", //path to atlases. Default: './'
hashUrl: "./src/", //where to store 'hash.json'. Atlases path will be used as default
scales: [1, 0.5] //output scales. Default: [1]
force: false //force rebuild all atlases. By default packed atlases will be skipped
defaultAtlasConfig: {
//Override default atlas config: extraSpace, jpeg, extrude, pot, square, colorDepth, animations, spriteExtensions
}
}
texturepackerify.pack(config, () => {
console.log("done!");
});Run:
$ node pack.jsOutput:
src
├──...
│ atlas1.png
│ atlas1.json
│ atlas2.png
│ atlas2.json
│ hash.json
│ ...Atlas Config
Each atlas can hold config.json with parameters:
"extraSpace"- space between texture frames. Default -2"border"- texture border. Default -0"jpeg"- output to jpeg. Default -false"extrude"- add extra pixels in bounds. Default -false"pot"- atlas size fixed to power of two. Default -true"square"- atlas size fixed to square. Default -false"colorDepth"- color depth for texture. Default -8"animations"- parse animations. Default -false"spriteExtensions"- add extension to frame name. Default -true
Example
Place config.json in atlas folder:
src
├── atlas1
│ ├── img0.png
│ ├── ...
│ ├── config.jsonconfig.json:
{
"extraSpace": 0,
"jpg": true,
"extrude": true,
"square": true,
"colorDepth": 8
}Extract
TexturePackerify can extract atlases. Place atlas.png and atlas.json to src folder.
Create extract.js:
const texturepackerify = require("texturepackerify");
texturepackerify.extract({url:"./src/"}, ()=>{console.log("done!")});Run:
$ node extract.js0.1.7
3 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.0
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.0.16
5 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago