python-visualization / branca

This library is a spinoff from folium, that would host the non-map-specific features.
https://python-visualization.github.io/branca/
MIT License
110 stars 63 forks source link

allow branca ColorMap in write_png #126

Closed Conengmo closed 1 year ago

Conengmo commented 1 year ago

Fixes https://github.com/python-visualization/folium/issues/1571 and https://github.com/python-visualization/folium/issues/1280, when we also merge https://github.com/python-visualization/folium/pull/1708.

Users expect to be able to pass a branca ColorMap to write_png and image_to_url. Make this possible by testing for the correct type and using the rgba_floats_tuple methods if it's a branca ColorMap. Add tests.

Also include changes from folium to the same function so we can remove the duplicate code from folium.