[OSM-dev] Optimising PNGs / Colour reduction

Grant Slater openstreetmap at firefishy.com
Tue Nov 20 13:00:53 GMT 2007


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]) 

Grant





More information about the dev mailing list