# gamefroot-texture-packer

> Tool for generating high quality texture atlases from a list of input files, backed by gamefroot.com and kiwi.js.

Latest version **1.1.2** (published 2018-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install gamefroot-texture-packer
pnpm add gamefroot-texture-packer
yarn add gamefroot-texture-packer
bun add gamefroot-texture-packer
```

Provides the command `gf-pack`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-07-26 |
| First published | 2015-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Maintainers | ranisputnik, ryanc1256 |
| Keywords | kiwi.js, gamefroot, pack, spritesheet, texture, starling, sparrow, pixi.js, json, cocos2d, easel.js, generator |

## Links

- npm: https://www.npmjs.com/package/gamefroot-texture-packer
- Repository: https://github.com/Gamefroot/Gamefroot-Texture-Packer
- Issues: https://github.com/Gamefroot/Gamefroot-Texture-Packer/issues
- npm.io page: https://npm.io/package/gamefroot-texture-packer

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^5.0.14
- [async](https://npm.io/package/async.md) ^1.4.0
- [mustache](https://npm.io/package/mustache.md) ^2.1.3
- [optimist](https://npm.io/package/optimist.md) ~0.6.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.2 (latest) — 2018-07-26
- 1.1.1 — 2015-09-27
- 1.1.0 — 2015-07-28
- 1.0.1 — 2015-07-13
- 1.0.0 — 2015-07-01
- 0.0.3 — 2015-06-16
- 0.0.2 — 2015-06-10
- 0.0.1 — 2015-06-10

## README

# Gamefroot Texture Packer

[![Build Status](https://travis-ci.org/Gamefroot/Gamefroot-Texture-Packer.svg?branch=master)](https://travis-ci.org/Gamefroot/Gamefroot-Texture-Packer)

Generate high quality texture atlases in Node.js, developed for [Gamefroot.com](http://gamefroot.com) and [Kiwi.js](http://www.kiwijs.org/). 

## Features

* Use growing-binpacking to optimise your texture memory
* Trim, scale and pad assets to further make use of space
* Add gutter (bleed) to your images to avoid nasty join lines
* Add a maximum width/height to conform to platform limitations
* Generate as many atlases as you need with a single command
* Use texture groups to ensure optimal run-time performance

## Supported spritesheet formats

* Kiwi.js
* Starling / Sparrow
* JSON (i.e. PIXI.js)
* Easel.js
* cocos2d
* CSS (new!)

## Usage

### Command Line

```bash
$ gf-pack assets/*.png
```

Options:

```bash
$ gf-pack
Usage: gf-pack [options] <files>

Options:
  -f, --format          format of spritesheet (kiwi, starling, sparrow, json, pixi.js, easel.js, cocos2d)                                           [default: ""]
  --cf, --customFormat  path to external format template                                                                                            [default: ""]
  -n, --name            name of generated spritesheet                                                                                               [default: "spritesheet"]
  -p, --path            path to export directory                                                                                                    [default: "."]
  -w, --width           The maximum width of the generated image(s), required for binpacking, optional for other algorithms                         [default: 999999]
  -h, --height          The maximum height of the generated image(s), required for binpacking, optional for other algorithms                        [default: 999999]
  --fullpath            include path in file name                                                                                                   [default: false]
  --prefix              prefix for image paths                                                                                                      [default: ""]
  --trim                removes transparent whitespaces around images                                                                               [default: false]
  --square              texture should be a square with dimensions max(width,height)                                                                [default: false]
  --powerOfTwo          texture width and height should be rounded up to the nearest power of two                                                   [default: false]
  --validate            check algorithm returned data                                                                                               [default: false]
  --scale               percentage scale                                                                                                            [default: "100%"]
  --fuzz                percentage fuzz factor (usually value of 1% is a good choice)                                                               [default: ""]
  --algorithm           packing algorithm: growing-binpacking (default), binpacking (requires w and h options), vertical or horizontal              [default: "growing-binpacking"]
  --padding             padding between images in spritesheet                                                                                       [default: 0]
  --sort                Sort method: maxside (default), area, width or height                                                                       [string]  [default: "maxside"]
  --maxAtlases          maximum number of texture atlases that will be outputted                                                                    [default: 0]
  --gutter              the number of pixels to bleed the image edge, gutter is added to padding value                                              [default: 0]
  --group               allows you to specify a group of assets that must be included in the same atlas, make sure to use quotes around file paths  [default: []]
  --resizeWidth         resizes all source images to a specific width                                                                               [default: 0]
  --resizeHeight        resizes all source images to a specific height                                                                              [default: 0]
```

### Node.js

```javascript
var packer = require('gamefroot-texture-packer');

packer('assets/*.png', {format: 'kiwi'}, function (err) {
  if (err) throw err;

  console.log('spritesheet successfully generated');
});
```

## Installation

1. Install [ImageMagick](http://www.imagemagick.org/)
2. `npm install gamefroot-texture-packer -g`

## Test

    mocha test

--------------
This library is based on the foundation work of [Spritesheet.js](https://github.com/krzysztof-o/spritesheet.js)

---
_Source: https://npm.io/package/gamefroot-texture-packer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
