Hacker News new | past | comments | ask | show | jobs | submit login

I would be curious to see how much memory would be saved if those tiles would use 1bit black and white.

I just tried saving one of those shade-of-grey "Toner" tile to "4 grey" in xnview, which I guess is a 2bit PNG, meaning it would use 4 shades of grey, so black, white, #555 and #AAA.

The tile went from 32kb to 6kb, so a 80% size reduction.

I'm really curious if this would allow one to store a country region with tiles on a smartphone. OSMand lets you download vector maps to browser them offline, but rendering can be a little slow on some phones.

EDIT: OSM tiles use a 256 colors palette, most tiles less than 10kb. I guess there are tools out there to generate a 8, 16 or 32 colors palette. XNView seems to use libimagequant to generate a palette.




Also, if you have the CPU cycles to spare, optipng (http://optipng.sourceforge.net/) can often find a nice reduction in size without having to change the actual image at all.


The current state of the art for small tilesets is to store vector data in tiles on the device, then render to raster there. It's way, way smaller than any realistic raster image.


sure but it's also slower to render


Hm, interesting. Thanks for idea. I think I will spin some script and imagemagick on tiles I just downloaded.


Remember than PNG compress data like it would for text, using DEFLATE:

https://en.wikipedia.org/wiki/Portable_Network_Graphics#Comp...

What doesn't change is raw data. In general maps are not like photography, maps are simplified diagrams so that things can be easily distinguished, and that makes them much easier to compress using lossless methods, so using a reduced amount of colors will not be really noticeable, especially if colors are properly chosen.

Look at the palette of an OSM tile: https://i.imgur.com/ecaP17l.png

Using a 8 color palette instead of 256 on xnview results in a 50% reduction. A 16 color palette results in about 40%, but the result is much better. So it does save memory but not that much.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: