[OSM-dev] NOT-saving empty Mapnik tiles

Oliver Tonnhofer olt at omniscale.de
Mon Aug 15 21:54:58 BST 2011

On 15.08.2011, at 22:46, Igor Podolskiy wrote:
> And PIL.Image.getcolors(1) might be fast - but it is still an iteration over all pixels of the image for a single-color image (I just looked it up in the PIL sources). You might just as well do it in Python without introducing a dependency on PIL just for that, see the first function from the last mail. If you want to do more image processing, then it's a different story. Then you can convert the mapnik.Image into a PIL.Image and have all the PIL goodness :)

No, it stops as soon as it sees the second color (for getcolors(1)) and Mapniks tostring() and PILs fromstring() are just a memory copy. So this will also be fast. Of course, you need PIL as a dependency.


Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.de
http://mapproxy.org | https://bitbucket.org/olt | @oltonn

More information about the dev mailing list