Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (60 sloc) 1.8 KB


The sprite generator


Spritopia pretend to be an easy to use, one command line tool, that do one task: Generate png sprites.


Supose you have 3 images called images/icons/cut.png, images/icons/copy.png and images/icons/paste.png, and you want to create a sprite with all of them.

For doing that you need to create a file. Where you put that file is important because the images will be relative to that file.

In our example, we are going to create images/icons.png. For doing that, we are going to create images/icons.sprite with the following content:


Now you have that file, you just need to call spritopia:

spritopia images/icons.sprite

This command will create two new files icons.png and icons.json in the same directory of our .sprite file.

icons.png is the actual sprite with all the images defined inside icons.sprite icons.json will have the coordinates of each image and the size.

For example, icons.json could be like this:


Now you can load that file with any program you want. The only files you are going to need is icons.png and icons.json.

Thats all.


gem install spritopia