How to add screenshot to READMEs in github repository?

Is it possible to place a screenshot in README file in a GitHub repository? What's the syntax?


If you use Markdown (README.md):

Provided that you have the image in your repo, you can use a relative URL:

![Alt text](/relative/path/to/img.jpg?raw=true "Optional Title")

If you need to embed an image that's hosted elsewhere, you can use a full URL

![Alt text](http://full/path/to/img.jpg "Optional title")

GitHub recommend that you use relative links with the ?raw=true parameter to ensure forked repos point correctly.

Check out an example: https://raw.github.com/altercation/solarized/master/README.md

Also, the documentation on relative links in README files: https://help.github.com/articles/relative-links-in-readmes

And of course the markdown docs: http://daringfireball.net/projects/markdown/syntax

Additionally, if you create a new branch screenshots to store the images you can avoid them being in the master working tree

You can then embed them using:

![Alt text](/../<branch name>/path/to/image.png?raw=true "Optional Title")

Even though there is already an accepted answer I would like to add another way to upload images to readme on GitHub.

  • You need to create issue in your repo
  • Drag and drop in the comment area your image
  • After link for the image is generated insert it to your readme
  • More details you can find here


    I found that the path to the image in my repo did not suffice, I had to link to the image on the raw.github.com subdomain.

    URL format https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH}

    Markdown example ![Settings Window](https://raw.github.com/ryanmaxwell/iArrived/master/Screenshots/Settings.png)

    链接地址: http://www.djcxy.com/p/7854.html

    上一篇: 在Github上将README更改为Readme.md

    下一篇: 如何在github存储库中添加屏幕截图到README?