ID:2127953
 
Applies to:
Status: Open

Issue hasn't been assigned a status value.
Right now, DM saves pngs using compressed RGBA, but png supports storing a palette chunk (up to 256 col(u)ors), and just storing palette indexes (compressed still), supporting a much much smaller bit depth for the actual data. Most DMI files have less than 256 colors, so this would massively reduce rsc sizes.

For shits and giggles, i tried it on a few of our dmis, and their size went to half or a third, a few of the less complex bigger ones went to less then 1/4 size.

Being able to cut a 60mb rsc download to ~10-25mb is way too easy of a target to pass up.
IIRC DM only saves *transparent* dmis with compressed RGBA. Fully opaque icons are saved as paletted RGB.
ya, i'm guessing whoever did the png stuff in byond didn't notice that you CAN in fact do transparency with palettes.

You just encode the palettes' transparency in a tRNS, as a parallel array of transparency to go with each palette entry. you can even do partially transparent palette entries first, then only add tRNS for those entries, skipping them for the rest, and png assumes 255 alpha for the missing palettes, if you want to save space.
Would be pretty neat.
Palette mode is something we actually have code for, but that code was disabled because it was found to be super detrimental to save times for dynamically created icons. (For icons saved in DM, probably it'd be reasonable.)