udoprog / c10t

A minecraft cartography tool
Other
225 stars 50 forks source link

Optimizing images #213

Open Sworddragon opened 12 years ago

Sworddragon commented 12 years ago

It seems that the images are every time 24 bit PNG files. I'm not sure if there are even more than 256 different objects that can be shown at the world map but c10t could count the different objects (colors) which it will drawn to the image (or per splitted image) and if they are not more than 256 the image could be converted to 8 bit. This would help webservices which provide a online worldmap with c10t to reduce the traffic.

uap-universe commented 12 years ago

This would only make any sense if the image is not just converted but already computed in 8 bit mode. So the rendering process itself would cost a quarter of the memory it uses now (in 32 bit rgba). This sounds like a huge impact on the source code. The current color class must become an adapter and the attributes inaccessible (as they are not rgba in 8 bit mode). Then the color setter must be overloaded by each representation (32bit / 8bit) and ommit additional information in 8 bit mode.

It's possible, but it would be a huge impact on the source code.

udoprog commented 12 years ago

hm, it's very much possible to produce a non 24 bit (8 bit per channel) and go for 16 bit (4 bit per channel), but the color ranges will be severely truncated.

If you want to implement this it would be during the writing process, but it would be possible to convert the entire process in order to save space using a template-esque implementation of color which ceils/floors on the fly. Dunno the performance or quality degredation tho.

Sworddragon commented 10 years ago

For the quality: The intended idea was that c10t makes an automatic optimization. For example it will reduce the color palette only of it doesn't withdraw used colors. And if the palette is below 257 colors it would be an 8 bit PNG.

evildeeds commented 10 years ago

c10t support and handles transparent colors internally, both leaves and water colors are partially transparent and will result in a large number of different colors depending on depth and blocks beneath.

I'm therefore not sure how useful this feature would be, I suppose if you used your own block pallet with few nontransparent colors it would make sense.