Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stevecondylios/dcadb4fc73e63f27a3bbcf17e52058bf to your computer and use it in GitHub Desktop.
Save stevecondylios/dcadb4fc73e63f27a3bbcf17e52058bf to your computer and use it in GitHub Desktop.
How to Resize an Image in a Github Issue (e.g. Github flavored Markdown)

How to Resize an Image in Github README.md (i.e. Github Flavored Markdown)

Percentage:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>

Pixels:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">

Quick tips!

  • To get a githubusercontent link for an image, drag and drop the image into any issue, and copy/paste the url from the code that is automatically generated. Example code: ![image](https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png)

  • If anyone knows of a very easy to use (preferably browser based, client side) app that converts a link an image in a repository to a githubusercontent/raw link, please comment with the app url

  • There is no way to change the size of an image if the markdown format is of the form []() - so stop looking right now! - you must use <img> instead

  • Another useful summary of conventions that do and don't work here

@MemoonaTahira
Copy link

I tried. The exact same thing like about a week ago, but it didn't work on some images. I might be doing something wrong. I'll double check. Not sure if it might be the image extension (my images were png) and this ones jpg. Thank you!

@jonchui
Copy link

jonchui commented Nov 12, 2022

If anyone knows of a very easy to use (preferably browser based, client side) app that converts a link an image in a repository to a githubusercontent/raw link, please comment with the app url

I 100% agree! I use loom (CMD+SHIFT+2) shortcut to create a link from clipboard.. but i'd love a tool that does that w/ github!

Then I can create image links and put them directly into the commit messages while working in terminal

@tadyen
Copy link

tadyen commented Jan 29, 2023

Thanks! I'm not led down a wild goosechase anymore

no way to change the size of an image if the markdown format is of the form []()

However it's still unfortunate that such is the case. The reason I even explored this topic was because using the <img src="" width=""> tag causes the images to not scale properly on small screens (eg mobile) or windows.

Kinda defeats the notion of markdown if I have to markup stuff to get it to work right, otherwise my images will have to be full-size.

@iAmKankan
Copy link

iAmKankan commented Jan 29, 2023

for me in github <img> is more convenient than ![]().
This is I frequently use while working with pictures, the best part is that picture captions is easy to add

<p align="center">
  <img src="https://user-images.githubusercontent.com/12748752/167583923-c90411f4-8b57-4663-93fa-be18ca47a7cb.png" width=45% /> <img src="https://user-images.githubusercontent.com/12748752/167583928-bfe56750-9917-4209-9eb5-04fc81743647.png" width=45% /> 
  <br>
  <img src="https://user-images.githubusercontent.com/12748752/167583932-9d195974-375c-48a6-84db-04fdbcb5fb6b.png" width=45% />
<br>
<ins><b><i> Activation functions and NN</i></b></ins>
</p>

@kissu
Copy link

kissu commented Jul 9, 2024

Wish GitHub would generate something simple with a prefix like StackOverflow does for us already.

@SirYodaJedi
Copy link

SirYodaJedi commented Aug 1, 2024

My oversized phone pictures in yquake2/yquake2#1130 are ending up with a private-user-images.githubusercontent.com url, which requires a unique access token. I ended up having to use <details> to collapse it, since <img> wouldn't work.

@prototyperspective
Copy link

This info is missing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment