texpack icon indicating copy to clipboard operation
texpack copied to clipboard

Merge identical sprites.

Open ninnghazad opened this issue 6 years ago • 5 comments

An option to merge identical sprites and not have multiple versions of the same image in atlas would be nice. Identical as in same pixels after trim.

ninnghazad avatar Mar 28 '18 11:03 ninnghazad

Hello and thank you for the suggestion. I'll take this into consideration, although I wonder... in what situations do you end up packing identical images? Should it also handle cases where images are identical if rotated or flipped?

urraka avatar Mar 28 '18 17:03 urraka

Maybe identical sprite warnings might be nice? Seems overkill to actually handle that.

josefnpat avatar Mar 29 '18 23:03 josefnpat

I am thinking about animations. In a walkcycle for example i have a char's head bob up and down. The head is it's own sprite. In the final atlas/pack i now have about 20 heads which are all identical pixel-wise, they will just be placed in differently. Detecting (90deg) rotated duplicates would be nice, but simple merge of plain duplicates would be a nice start. And i don't need a warning, i already know that there will be duplicate sprites. There are packers around that offer this feature (eg: https://github.com/scriptum/Cheetah-Texture-Packer) - but i like this one the best so far.

ninnghazad avatar Mar 30 '18 16:03 ninnghazad

That sounds reasonable enough to me. I can make it handle plain duplicates for a start and then see if rotated/flipped can be added.

urraka avatar Mar 30 '18 19:03 urraka

@ninnghazad smart thinking!

josefnpat avatar Apr 02 '18 04:04 josefnpat