检出Texturepacker
http://www.texturepacker.com/
它输出这样的文件(取决于您的首选设置)
{
"filename": "image_front_1",
"frame": {"x":1,"y":160,"w":34,"h":52},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":2,"w":36,"h":40},
"sourceSize": {"w":36,"h":40}
},
{
"filename": "image_front_2.png",
"frame": {"x":36,"y":160,"w":34,"h":52},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":36,"h":42},
"sourceSize": {"w":36,"h":42}
},
{
"filename": "image_front_3.png",
"frame": {"x":71,"y":160,"w":34,"h":52},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":34,"h":52},
"sourceSize": {"w":36,"h":42}
},
{
"filename": "image_front_4.png",
"frame": {"x":106,"y":160,"w":34,"h":52},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":34,"h":52},
"sourceSize": {"w":36,"h":42}
}
使用此数据,您可以轻松地从图像中抓取单独的矩形。