Jump to content

Do I Have To Specify Image Sizes In *.JSON File?


Recommended Posts


Working on PNG image sprite core today.
I looked at the demo's *.JSON file and see that is has image sizes.
Must I specify image sizes in the *.JSON file?

	"frame": {"x":55,"y":2,"w":32,"h":24},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":32,"h":24},
	"sourceSize": {"w":32,"h":24},
	"pivot": {"x":0.5,"y":0.5}

(my game would have 100's of images and the above would be cumbersome.

Let me know, Thanks!


Link to comment
Share on other sites


Seems like all the image sprites are in one giant single PNG?
Do I have to do the above??
(I have about a 100 sprites in the game and the above would be a nightmare to do)


Link to comment
Share on other sites

There is a big performance advantage to have as few images loaded and used as possible. Therefore games tend to use 'sprite/texture atlases', in which lots of individual images are combined into one big one. Then the libs can use the json data to work out which part of that big image contains the smaller image needed to be displayed.

Don't worry, it's not hand done, there are lots of tools to generate this all for you, like TexturePacker. Pixi can use the json format exported by that tool natively.

Link to comment
Share on other sites

Like @themoonrat mentioned, I recommend not doing this by hand.

Save all your images as separate files like you normally would then use a tools like TexturePacker or ShoeBox to generate the atlas image and associated json file. TexturePacker is worth every penny, but there are tons of other tools out there as well.

Good luck!


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...