Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FloatImage not working in folium v0.13.0 #1667

Closed
giswqs opened this issue Nov 27, 2022 · 1 comment · Fixed by #1668
Closed

FloatImage not working in folium v0.13.0 #1667

giswqs opened this issue Nov 27, 2022 · 1 comment · Fixed by #1668
Labels
bug An issue describing unexpected or malicious behaviour

Comments

@giswqs
Copy link
Contributor

giswqs commented Nov 27, 2022

Describe the bug
FloatImage does not work properly in folium v0.13.0. The image appears to be enlarged many times.

To Reproduce

import folium
from folium.plugins import FloatImage
import base64

m = folium.Map()
image = 'LmTETPX.png'  # downloaded from 'https://i.imgur.com/LmTETPX.png'
with open(image, "rb") as lf:
    b64_content = base64.b64encode(lf.read()).decode("utf-8")
    widget = FloatImage(
        "data:image/png;base64,{}".format(b64_content),
        bottom=50,
        left=75,
    )
widget.add_to(m)
m

image

Directly passing the image path does not work either.

m = folium.Map()
image = 'LmTETPX.png'  # downloaded from 'https://i.imgur.com/LmTETPX.png'
FloatImage(image, bottom=50, left=75).add_to(m)
m

image

Expected behavior

It works as expected in folium v0.12.1.post1

image

Environment (please complete the following information):

  • Browser: chrome
  • Jupyter Notebook
  • Python version: 3.9
  • folium version: 0.13.0
  • branca version: 0.4.2
@Conengmo
Copy link
Member

Conengmo commented Nov 28, 2022

Thanks for the report! I can confirm the issue. This is very likely because of #1570. I think the fix is simple: make width an optional parameter. I'll open a PR.

@Conengmo Conengmo added the bug An issue describing unexpected or malicious behaviour label Nov 28, 2022
@Conengmo Conengmo added the work in progress Work is in progress on a PR, check the PR to see its status label Nov 28, 2022
@Conengmo Conengmo removed the work in progress Work is in progress on a PR, check the PR to see its status label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue describing unexpected or malicious behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants