Skip to content

FloatImage not working in folium v0.13.0 #1667

Closed
@giswqs

Description

@giswqs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue describing unexpected or malicious behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions