[Tilecache] everyblock use of tilecache & openlayers

Christopher Schmidt crschmidt at metacarta.com
Thu Jan 24 13:37:20 EST 2008


On Thu, Jan 24, 2008 at 06:06:04PM +0000, Graham Carlyle wrote:
> Can't use you PIL for this? I'm no expert but seems to produce ok
> results...
> 
> --
> import Image
> 
> whole_map = Image.open("world.png")
> tile = whole_map.copy()
> tile = whole_map.crop((0, 0, 256, 256))
> intermediary_whole_map = whole_map.convert("RGB")
> reduced_map = intermediary_whole_map.convert("P",
>                                              dither=Image.NONE,
>                                              palette=Image.ADAPTIVE)
> intermediary_tile = tile.convert("RGB")
> quantized_tile = intermediary_tile.quantize(palette=reduced_map)
> reduced_tile = quantized_tile.convert("P")
> reduced_map.save("reduced_map.png", optimize=True)
> reduced_tile.save("reduced_tile.png", optimise=True)
> --

The problem that I see with this mechanism (as far as TileCache is
concerned) is that I don't know how the reduced_map is stored? It seems
like you'd have to re-create your palette each time? Or maybe
reduced_map is some serializable data structure you could use.

That said, I didn't get this far with my PIL experimentation -- I'm
pretty bad at PIL, so I kinda just hacked at it for a bit, then gave up.
Something like this certainly makes sense, and if it works, then I could
be convinced to provide a 'hook' for it (or other data manipulation),
though I'm not sure where it's best implemented: at the metaTile level,
or at the tile level.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list