Skip to content

Instantly share code, notes, and snippets.

@MichaelPolla
Last active May 11, 2026 01:14
Show Gist options
  • Select an option

  • Save MichaelPolla/a65ac84286ab523603e64549f9850223 to your computer and use it in GitHub Desktop.

Select an option

Save MichaelPolla/a65ac84286ab523603e64549f9850223 to your computer and use it in GitHub Desktop.
Markdown - Resize pictures in GitHub, including in comments comment

Markdown - Resize pictures in GitHub

I found that the "best" way is to use HTML, as it works both in Readme/.md files and also in comments (within Issues, Gist...)

E.g. when adding/editing a comment (within Issues, Gist...) :

  • Upload the picture by drag-and-drop in the text field
  • replace ![image](https://your-image-url.type) with <img src="https://your-image-url.type" width="100" height="100">

As mentioned by @cbestow (thanks!), it's not mandatory to set both width and height. If only one is set, the other will be adjusted accordingly to preserve the aspect ratio of the image.

ghost commented Aug 31, 2023

Copy link
Copy Markdown

Beautiful!

@OlgaErshova1

Copy link
Copy Markdown

Thank you, worked for me

@RymMichaut

Copy link
Copy Markdown

worked for me too. Thanks :) well explained

@mahnazmh

mahnazmh commented Oct 3, 2023

Copy link
Copy Markdown

Thank you :)

@HOSS11H

HOSS11H commented Oct 13, 2023

Copy link
Copy Markdown

thx

@VASANTHAPUVVADA

Copy link
Copy Markdown

Good

@vilsijain

Copy link
Copy Markdown

Thank you it works for me

@k-Gillespie

k-Gillespie commented Mar 21, 2024

Copy link
Copy Markdown

can confirm it works well, thank you.

@effiban

effiban commented Apr 10, 2024

Copy link
Copy Markdown

thanks!!

@xiaotianxt

Copy link
Copy Markdown

Does anyone know a way to keep aspect ratio during the image loading? If I use

<img width="100%" style="aspect-ratio: 16 / 9" src="xxx" >

Github will remove the style attribute, and it doesn't work.

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