Hi all,
sorry for jumping into this discussion so late.
On 15.08.2011, at 20:56, Igor Podolskiy wrote:
> Actually, mapnik _can_ save a PNG to a buffer. My accusation from the
> previous mail that it couldn't do it was totally wrong, sorry for that :(
> Here is how it works:
>
> def is_empty_by_size(mapnik_image):
> return im.tostring('png256') == 116
This depends on the actual implementation of the PNG encoder, since the size
might change if the implementation changes.
PILs getcolors is the "right" method for that. It is the fastest way to do it,
if you limit it to one color. See how I did that in MapProxy for the
link_single_color_image feature:
https://bitbucket.org/olt/mapproxy/src/04dec4a33735/mapproxy/image/__init__.py#cl-387
Regards,
Oliver
--
Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de
http://mapproxy.org | https://bitbucket.org/olt | @oltonn
_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/dev