I'm using mapnik (python api) to render a very simple map where land polygons are black and water is white. There are no other features on the map. I'd like to detect if my tile is completely solid (ie. either black or white) so I can mark the tile as being 'fully land' or 'fully water'... this would help me save a ton of space later on when I pack the tiles together.
I know you can call the painted() function on an image in mapnik, but I don't think this works if a feature gets painted.
>>> im = Image(256,256)
>>> im.background = Color('white')
>>> m = Map(256,256)
>>> render(m,im)
>>> im.painted() # should be False