[OSM-dev] Optimising PNGs / Colour reduction

Robert (Jamie) Munro rjmunro at arjam.net
Tue Nov 20 14:33:13 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Grant Slater wrote:
> Robert (Jamie) Munro wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Jon Burgess wrote:
>>  
>>> Approximately half the time spent to rendering a single tile in the
>>> Mapnik layer is spent in the colour conversion (color255) so the speed
>>> of this code is very important to the overall tile processing rate.
>>>     
>>
>> Rather than using imagemagik to calculate a pallette each time, can
>> Mapnik draw to a 4bits per channel (12 bit) image instead of a 8bits per
>> channel (24 bit) image? 
> 
> sudo patch for tile.openstreetmap.org/render_from_list.py (untested)
> 
>  fh = open(tile_uri,'w+b')
> -  im.save(fh, 'PNG', quality=100)
> + im.save(fh, 'PNG', bits=4)
>  #call(["convert", "-colors", "255", tile_uri, tile_uri])
> -  call(["color255", tile_uri])

Why are we compressing the image as a 24 bit PNG, then uncompressing it
inside the convert command, reducing the colour pallette and compressing
again? Can't we save as an uncompressed format, and only make it into a
PNG once?

Robert (Jamie) Munro


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHQvAmz+aYVHdncI0RAsIeAJ4i5e4oj9tPj1OkBuCmQMgbgSQh2gCg4unZ
IqtDuYGPKahVNaGhGbdrYtY=
=IBPE
-----END PGP SIGNATURE-----




More information about the dev mailing list