[OSM-dev] NOT-saving empty Mapnik tiles
igor.podolskiy at vwi-stuttgart.de
Fri Aug 12 19:02:27 BST 2011
sorry, I misread your first mail, it's not a PIL.Image but a
mapnik.Image - it doesn't have all those fancy methods of a PIL Image. I
don't know how to convert from mapnik to PIL now, either :( My fault.
But I just had another idea.
If your current method works for you and it's just about reducing disk
IO, you just could use StringIO  or the like and save the PNG image
to a buffer first, then check its length and conditionally save it to disk:
buf = StringIO.StringIO()
# ... render the image somehow here ...
if buf.len > 116:
f = open(tile_name, 'wb')
More information about the dev