[github] 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?

This question is related to github markdown

The answer is


Add image in repository from upload file option then in README file

![Alt text]("enter image url of repositoryhere") 

To me the best way is -

  1. Create an new issue with that repository on github and then upload the file in gif format.To convert video files into gif format you can use this website http://www.online-convert.com/
  2. Submit the newly created issue.
  3. Copy the address of the uploaded file
  4. Finally in your README file put ![demo](COPIED ADDRESS)

Hope this will help .


JUNE 3, 2020 : WORKING ANSWER-

  1. Upload your image to postimage.org
  2. Copy Github-Markdown-Url after uploading Image
  3. Insert in your ReadMe

add this to README

<div align="center">
    <img src="/screenshots/screen1.jpg" width="400px"</img> 
</div>

Much simpler than adding URL Just upload an image to the same repository, like:

![Screenshot](screenshot.png)


Markdown: ![Screenshot](http://url/to/img.png)

  • Create an issue regarding adding images
  • Add the image by drag and drop or by file chooser
  • Then copy image source

  • Now add ![Screenshot](http://url/to/img.png) to your README.md file

Done!

Alternatively you can use some image hosting site like imgur and get it's url and add it in your README.md file or you can use some static file hosting too.

Sample issue


Add ![ScreenShot](screenshot.png) in the readme markdown as mentioned by many above. Replace screenshot.png with the name of the image you uploaded in your repository.

But here is a newbie tip when you upload the image (as I made this mistake myself):

ensure that your image name does not contain spaces. My original image was saved as "Screenshot day month year id.png". If you don't change the name to something like contentofimage.png, it won't appear as an image in your readme file.


One line below should be what you looking for

if your file is in repository

![ScreenShot](https://raw.github.com/{username}/{repository}/{branch}/{path})

if your file is in other external url

![ScreenShot](https://{url})

I googled a few similar questions and did not see any answers with my problem and its quite simple/easy solution.

Google Cloud Storage - a slightly different approach to images in READMEs

Here goes: like the OP, I wanted an image in my Github README, and, knowing the Markdown syntax for doing so, typed it in:

![My Image](https://storage.cloud.google.com/${MY_BUCKET}/${MY_IMAGE}

You need to complete the actual substitutions above (e.g. MY_IMAGE=image.jpg) for this to work.

But, wait...failure--there's no actual rendered photo! And the link is exactly as given by Google Storage!

screenshot of failed Github image upload

Github camo - Anonymous Images

Github hosts your images anonymously, yay! However, this presents an issue for Google storage assets. You need to get the generated url from your Google Cloud Console.

I'm sure there's a smoother way, however, simply visit your given URL endpoint and copy the long URL. Details:

Instructions

  1. Visit your storage console: https://console.cloud.google.com/storage/browser/${MY_BUCKET}?project=${MY_PROJECT}
  2. Click on the image you'd like to display in Github (this brings up the "Object Details" page)
  3. Copy pasta that URL (the one starting with https not gs) into a new browser tab/window
  4. Copy pasta the new generated URL -- it should be longer -- from your new browser tab/window into your Github README file

Hopefully this helps speed up and clarify this issue for anyone else.


The markdown syntax for displaying images is indeed:

![image](https://{url})

BUT: How to provide the url ?

  • You probably do not want to clutter your repo with screenshots, they have nothing to do with code
  • you might not want either to deal with the hassle of making your image available on the web... (upload it to a server... ).

So... you can use this awesome trick to make github host your image file. TDLR:

  1. create an issue on the issue list of your repo
  2. drag and drop your screenshot on this issue
  3. copy the markdown code that github has just created for you to display your image
  4. paste it on your readme (or wherever you want)

http://solutionoptimist.com/2013/12/28/awesome-github-tricks/


Method 1->Markdown way

![Alt Text](https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH})

Method 2->HTML way

<img src="https://link(format same as above)" width="100" height="100"/>

or

<img src="https://link" style=" width:100px ; height:100px " />

Note-> If you don't want to style your image i.e resize remove the style part


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)


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


With the images located in /screen-shots directory. The outer <div> allows the images to be positioned. Padding is achieved using <img width="desired-padding" height="0">.

<div align="center">
        <img width="45%" src="screen-shots/about.PNG" alt="About screen" title="About screen"</img>
        <img height="0" width="8px">
        <img width="45%" src="screen-shots/list.PNG" alt="List screen" title="List screen"></img>
</div>

First, create a directory(folder) in the root of your local repo that will contain the screenshots you want added. Let’s call the name of this directory screenshots. Place the images (JPEG, PNG, GIF,` etc) you want to add into this directory.

Android Studio Workspace Screenshot

Secondly, you need to add a link to each image into your README. So, if I have images named 1_ArtistsActivity.png and 2_AlbumsActivity.png in my screenshots directory, I will add their links like so:

 <img src="screenshots/1_ArtistsActivity.png" height="400" alt="Screenshot"/> <img src=“screenshots/2_AlbumsActivity.png" height="400" alt="Screenshot"/>

If you want each screenshot on a separate line, write their links on separate lines. However, it’s better if you write all the links in one line, separated by space only. It might actually not look too good but by doing so GitHub automatically arranges them for you.

Finally, commit your changes and push it!