notebook: Images in Markdown not showing when uploaded to Github
I have used the below syntax to display images in notebooks
<img src="image.png">
This works well when I run the notebook locally. But when uploaded to Git the image is not displayed.
I have tried other syntax like 
also but no luck.
Please help to clarify this issue. Thanks.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 65 (5 by maintainers)
Commits related to this issue
- Try to fix image - Quote first image Source : https://github.com/jupyter/notebook/issues/3278 — committed to pierreconreaux/wrangle_and_analyze_data by pierreconreaux 6 years ago
- Fixed Image Issue On Git Created local copies of the images for my notebook in order to attempt to fix the visualization issue on Git. Potential bug: https://github.com/jupyter/notebook/issues/3278 — committed to ProsperousHeart/TrainingUsingJupyter by ProsperousHeart 6 years ago
- Merge pull #14 from /training-update | Fixed Image Issue On Git Created local copies of the images for my notebook in order to attempt to fix the visualization issue on Git. Potential bug: https://... — committed to ProsperousHeart/TrainingUsingJupyter by ProsperousHeart 6 years ago
- problem with unquoted html parameters see: https://github.com/jupyter/notebook/issues/3278 — committed to gsdavid/spherometer by gsdavid 6 years ago
- Added "" and a trailing ? to <img src="" ... /> following suggestions on: https://github.com/jupyter/notebook/issues/3278, so that images are displayed on Github page. — committed to rayguna/Microcontroller-Projects by rayguna 6 years ago
- workaround for github image renderer https://github.com/jupyter/notebook/issues/3278#issuecomment-663297099 — committed to BlockScience/reflexer by markusbkoch 4 years ago
- workaround for github image renderer https://github.com/jupyter/notebook/issues/3278#issuecomment-663297099 — committed to BlockScience/reflexer-digital-twin by markusbkoch 4 years ago
- Change inline notebook images to links ... to work around https://github.com/jupyter/notebook/issues/3278#issuecomment-992752682 — committed to qiskit-community/prototype-quantum-kernel-training by garrison 3 years ago
- Change inline notebook images to links ... to work around https://github.com/jupyter/notebook/issues/3278#issuecomment-992752682 — committed to qiskit-community/prototype-quantum-kernel-training by garrison 3 years ago
- Change inline notebook images to links ... to work around https://github.com/jupyter/notebook/issues/3278#issuecomment-992752682 — committed to qiskit-community/prototype-quantum-kernel-training by garrison 3 years ago
- Change inline notebook images to links ... to work around https://github.com/jupyter/notebook/issues/3278#issuecomment-992752682 — committed to qiskit-community/prototype-quantum-kernel-training by garrison 3 years ago
- Change inline notebook images to links (#5) ... to work around https://github.com/jupyter/notebook/issues/3278#issuecomment-992752682 — committed to qiskit-community/prototype-quantum-kernel-training by garrison 3 years ago
I spent some time figuring out what the problem with my image was. It turns out that Jupyter renders the following correctly and Github fails to do so:
<img src="myimage.png", width=800>
<img src="myimage.png", width="800">
The following fixes the problem (notice the absence of comma and the trailing /):
<img src="myimage.png" width="800" />
Hopefully, it’ll be helpful to somebody else.
RE: Images in markdown/html not showing when uploaded to a private repository
If I recall correctly, I don’t think I had this issue before. Maybe github’s notebook rendering engine has changed recently???
So far, the only solution that worked for me was this aesthetically unappealing ugly snippet:
HTTP paths use forward slashes (
/
) not backslashes (\
).If that’s not us, can you point to an example on Github?
With regard to images not displaying properly in private notebooks hosted on GitHub, this is actually a bug in GitHub’s notebook hosting. If you right click on such a broken image and open it in a new tab, it displays in the new tab properly, even though it displays as broken in the notebook.
What is happening is as follows: The browser does not provide the
Cookie
http header when the image is requested from the notebook because the request does not meet the “same origin” test. Without that cookie to prove the user should indeed see the content, GitHub’s server returns a 404, rather than a 302 redirect to the image hosted onhttps://raw.githubusercontent.com/
.I believe that GitHub could fix this by sending HTTP response headers such that this request would pass the “same origin” test.
Even I tried both,
"<img src=".images/functions.png)" />"
and"",
but none works in a private repo.None, of the above answers, is working for a private repository. I tried both,
<img src="../images/myimage.png)" />
and
@JuzerShakir

works for me.images/
is the relative directory.It appears Github doesn’t like your unquoted
width=800
. I changed it towidth="800"
and it worked.I’m closing this issue here, since this isn’t a bug in Jupyter Notebook.
Instead, it’s a difference in how Github renders notebooks. The images must be checked-in to the Github repository and (it appears) the links in the notebook must use raw HTML
<img>
tags for Github to find the images.Unfortunately, Jupyter has no control over how Github renders notebooks; a better solution is to view notebooks on Github using nbviewer.
If you have further questions related to rendering images in notebooks, we suggest you post your questions on Jupyter’s Discourse page.
Thanks all!
Check your file extension in markdown, cause git are case sensitive example (.jpg to .JPG)
I have tested most of the comments; however, following way worked for me.
I met the same questions too. But the reason of my problem is interesting. I use the windows’s captute tool . The pic format saved is .PNG ,however in the local ipynb i use

it works well. But in github,it doesn’t. when I change
to
. It works well both in github and local.Filenames on Linux are case sensitive, so
xx.PNG
andxx.png
are two different files, whereas on Windows they’re the same. URLs generally follow the Linux pattern, but it’s up to whatever serves the file how it handles finding it. I would guess tornado just checks if it can open the file, and doesn’t check that the name matches exactly.It works for private repository. Be sure that you push the image into repository.

I also encountered a similar problem here where my image is not showing. I used the
background-image
in CSS as follows:background-image: url(/images/sanadreas.jpg);
When I uploaded the images to GitHub and checked the website on a desktop, some images were showing, some were not. When I tested it on mobile, all images were not showing. I’m still looking for a good fix.
Try removing the space before img, i.e.
<img src="image/data_cleaning1.jpg" width="85%" />
What is weird is that I have some wiki pages with

and the image would show up fine while some with exact code not working.This code seems to work for me now
<img src="img/my-image.png" />
Yup - that resolved it. No issue here. 😃
I haven’t tested images locally - but if you copy/paste into the Jupyter notebook, it keeps the image. However when uploaded to git this isn’t moved over. Interesting “bug” - will try uploading the images to git and changing Jupyter notebook to look for the image locally.