npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gamefroot-texture-packer

v1.1.2

Published

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

Downloads

61

Readme

Gamefroot Texture Packer

Build Status

Generate high quality texture atlases in Node.js, developed for Gamefroot.com and Kiwi.js.

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

$ gf-pack assets/*.png

Options:

$ 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

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
  2. npm install gamefroot-texture-packer -g

Test

mocha test

This library is based on the foundation work of Spritesheet.js