New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@arjanfrans/spritesheet-generator

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arjanfrans/spritesheet-generator

Spritesheet generator

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

spritesheet.js

Spritesheet.js is command-line spritesheet (a.k.a. Texture Atlas) generator written in node.js.

###Supported spritesheet formats###

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

###Usage###

  1. Command Line
    $ spritesheet-js assets/*.png
    
    Options:
    $ 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: "."]
    --fullpath    include path in file name                                                                                                        [default: false]
    --prefix      prefix for image paths (css format only)                                                                                         [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]
    --validate    check algorihtm returned data                                                                                                    [default: false]
    --algorithm   packing algorithm: growing-binpacking (default), binpacking (requires passing width and height options), vertical or horizontal  [default: "growing-binpacking"]
    --padding     padding between images in spritesheet                                                                                            [default: 0]
    --scale       percentage scale                                                                                                                 [default: "100%"]
    --fuzz        percentage fuzz factor (usually value of 1% is a good choice)                                                                    [default: ""]
    --extrude     extend the image border by the outer pixels                                                                                      [default: 0]
    
  2. 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 dont't support this feature.*
![Trimming / Cropping](http://i.imgur.com/76OokJU.png)

###Installation###
1. Install [ImageMagick](http://www.imagemagick.org/)
2. ```npm install spritesheet-js -g```

###Test###

mocha test


--------------
Thanks [Przemysław Piekarski](http://www.behance.net/piekarski) for logo design and assets in examples.

Keywords

FAQs

Package last updated on 04 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc