[OSM-dev] NOT-saving empty Mapnik tiles
igor.podolskiy at vwi-stuttgart.de
Fri Aug 12 18:36:28 BST 2011
> Is there a function like im.is_empty() ?
um, what is your definition of "empty" exactly? Is it "all pixels are
transparent"? Or is it "all pixels are of the same color"? Or is it "all
pixels are of color X"? I don't think there's an Image.is_empty()
because "empty" means different things to different people.
There are different ways to do that depending on the definition. You can
loop over the image pixels with im.getdata() and check some property of
an image, or you might want to take a look on im.getcolors() dictionary
which tells you how often a color occurs in the image. There's PIL
documentation for all the Image methods here: .
If you have difficulties writing that down in Python, I'd be happy to
help - just drop me a line here.
More information about the dev