Skip to content

bug: exception when showing image in jupyter notebook #4072

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

Open
chuanlei-coding opened this issue Mar 26, 2025 · 6 comments · May be fixed by #4255
Open

bug: exception when showing image in jupyter notebook #4072

chuanlei-coding opened this issue Mar 26, 2025 · 6 comments · May be fixed by #4255
Labels
bug Something isn't working expression A new expression p1 Important to tackle soon, but preemptable by p0

Comments

@chuanlei-coding
Copy link
Contributor

Describe the bug

Image

To Reproduce

No response

Expected behavior

No response

Component(s)

Expressions

Additional context

No response

@chuanlei-coding chuanlei-coding added bug Something isn't working needs triage labels Mar 26, 2025
@chuanlei-coding
Copy link
Contributor Author

Image

@rchowell
Copy link
Contributor

When you do a url_download, the returned type is a binary which is why it shows as a base64 string.

@rchowell
Copy link
Contributor

rchowell commented Mar 26, 2025

The error looks like your jpeg has an unsupported encoding 'Rgba8' but we do support this with "rgba". Could you try url_download(url).image.decode('RGBA')

@rchowell rchowell added expression A new expression p1 Important to tackle soon, but preemptable by p0 and removed needs triage labels Mar 26, 2025
@rchowell rchowell self-assigned this Mar 26, 2025
@rchowell
Copy link
Contributor

@chuanlei-coding please let me know if the suggestion works for you, thank you!

@chuanlei-coding
Copy link
Contributor Author

@chuanlei-coding please let me know if the suggestion works for you, thank you!

import daft
df = daft.from_pydict(
        {
            "urls": [
                "https://www.getdaft.io/_static/stairs.png",
            ]
        }
    )
df2 = df.with_column("image", df["urls"].url.download().image.decode())
df2.show()

daft cannot deal with png image currently.

Image

@rchowell rchowell removed their assignment Apr 1, 2025
@desmondcheongzx desmondcheongzx linked a pull request Apr 26, 2025 that will close this issue
@desmondcheongzx
Copy link
Contributor

Took a quick look, this bug only happens when we preview images in a notebook. In these cases we were incorrectly encoding images that have an alpha channel as JPEG.

Fix is here #4255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working expression A new expression p1 Important to tackle soon, but preemptable by p0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants