Visitar URL original
Use the file path as the source of a non-embedded local Image by kaanisthatyou · Pull Request #15433 · ipython/ipython · GitHub
Skip to content

Use the file path as the source of a non-embedded local Image - #15433

Merged
Carreau merged 1 commit into
ipython:mainfrom
kaanisthatyou:fix/image-local-file-src
Oct 21, 2026
Merged

Carreau merged 1 commit into
ipython:mainfrom
kaanisthatyou:fix/image-local-file-src

Conversation

@kaanisthatyou

@kaanisthatyou kaanisthatyou commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13971. (written with an AI coding agent, Claude Code)

Image("dog.jpg", embed=False) and Image(filename="dog.jpg", embed=False) render <img src=""/>: the path ends up in filename, but the non-embedded _repr_html_ only reads url. This falls back to filename, the same way Video._repr_html_ does, and updates the filename docstring, which said images from a file are always embedded.

The regression test covers both the filename= keyword and a path passed as data, through _repr_html_ and _repr_mimebundle_.

#15368 made the same change and was closed by its author after the question about commit attribution; its author is credited as co-author here, with the GitHub noreply address that commit was missing.

Image(filename=..., embed=False), or a local path passed as data with
embed=False, rendered <img src=""/>: the path is stored in `filename`,
but _repr_html_ only looked at `url`. Fall back to the filename, as
Video already does, and update the docstring that said images from a
file are always embedded.

Fixes ipython#13971

Co-authored-by: fff122 <159777134+fff122@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Carreau
Carreau force-pushed the fix/image-local-file-src branch from 0a343e9 to efc25f5 Compare October 21, 2026 09:40
@Carreau
Carreau merged commit 976dadb into ipython:main Oct 21, 2026
24 checks passed
@Carreau Carreau added this to the 9.18 milestone Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in Image when using local file withembed=False

2 participants