Skip to content

Detect Duplicate Images and alias them? #75

Description

@jestarray

TexturePacker https://www.codeandweb.com/texturepacker
has an option to first trim and then detect identical sprites and then only duplicate/alias them in a resulting data file.json which can save a lot of space.

image

{"frames": [
{
	"filename": "1 - Copy.png",
	"frame": {"x":377,"y":83,"w":48,"h":64},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":48,"h":64},
	"sourceSize": {"w":48,"h":64}
},
{
	"filename": "1.png",
	"frame": {"x":377,"y":83,"w":48,"h":64},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":48,"h":64},
	"sourceSize": {"w":48,"h":64}
},
{
	"filename": "2.png",
	"frame": {"x":1,"y":163,"w":128,"h":64},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":128,"h":64},
	"sourceSize": {"w":128,"h":64}
},
{
	"filename": "3.png",
	"frame": {"x":275,"y":83,"w":100,"h":39},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":100,"h":39},
	"sourceSize": {"w":100,"h":39}
},
{
	"filename": "4.png",
	"frame": {"x":131,"y":165,"w":45,"h":159},
	"rotated": true,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":45,"h":159},
	"sourceSize": {"w":45,"h":159}
},
{
	"filename": "5.png",
	"frame": {"x":292,"y":124,"w":82,"h":82},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":9,"y":9,"w":82,"h":82},
	"sourceSize": {"w":100,"h":100}
},
{
	"filename": "6.png",
	"frame": {"x":133,"y":1,"w":160,"h":80},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":160,"h":80},
	"sourceSize": {"w":160,"h":80}
},
{
	"filename": "7.png",
	"frame": {"x":295,"y":1,"w":80,"h":130},
	"rotated": true,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":80,"h":130},
	"sourceSize": {"w":80,"h":130}
},
{
	"filename": "8.png",
	"frame": {"x":1,"y":1,"w":130,"h":160},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":130,"h":160},
	"sourceSize": {"w":130,"h":160}
},
{
	"filename": "9.png",
	"frame": {"x":133,"y":83,"w":80,"h":140},
	"rotated": true,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":80,"h":140},
	"sourceSize": {"w":80,"h":140}
},
{
	"filename": "10.png",
	"frame": {"x":292,"y":208,"w":80,"h":16},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":80,"h":16},
	"sourceSize": {"w":80,"h":16}
}]}

here are the resulting files:
test

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions