Skip to content

ambuddy/Spritesheet-Unpacker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Spritesheet Unpacker

Unpack sprites from PNG spritesheet(atlas) with nodejs

This script extracts all frames from a PNG spritesheet according to its JSON-file and puts them into the folder created next to it.

Usage: node unpack [filename.png[, filename.json[, output_foldername]]]

Assumes that spritesheet is a PNG-file and its JSON is a TexturePacker like (not rotated), i.e.

{"frames": 
  {
    "games/smsh!/res/img/ui/buttons/left/down.png":
    {
      "frame": {"x":1305,"y":246,"w":38,"h":47}
    },
    "games/smsh!/res/img/ui/buttons/left/over.png":
    {
      "frame": {"x":1289,"y":303,"w":38,"h":47}
    },
    "games/smsh!/res/img/ui/buttons/left/up.png":
    {
      "frame": {"x":1329,"y":295,"w":38,"h":47}
    }
  }
}

or is array "frames" of [x,y,width,height] arrays, i.e.

{"frames": [
  [860, 514, 96, 48],
  [960, 608, 96, 48],
  [960, 740, 32, 16]
]}

'fs-extra', 'path' and 'pngjs' packages required. Use 'npm install pngjs', etc.

History:

1.1.0 Rotated sprites are now supported (but not rotated back)

About

Unpack sprites from spritesheet (atlas)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published