I just got started with Markdown. I love it, but there is one thing bugging me: How can I change the size of an image using Markdown?
The documentation only gives the following suggestion for an image:
 If it is possible I would like the picture to also be centered. I am asking for general Markdown, not just how GitHub does it.
234 Answers
You could just use some HTML in your Markdown:
<img src="drawing.jpg" alt="drawing" width="200"/> Or via style attribute (not supported by GitHub)
<img src="drawing.jpg" alt="drawing"/> Or you could use a custom CSS file as described in this answer on Markdown and image alignment
 CSS in another file:
img[alt=drawing] { width: 200px; } 8With certain Markdown implementations (including Mou and Marked 2 (only macOS)) you can append =WIDTHxHEIGHT after the URL of the graphic file to resize the image. Do not forget the space before the =.
 You can skip the HEIGHT
 And Width
 22The accepted answer here isn't working with any Markdown editor available in the apps I have used till date like Ghost, Stackedit.io or even in the StackOverflow editor. I found a workaround here in the StackEdit.io issue tracker.
The solution is to directly use HTML syntax, and it works perfectly:
<img src="" width="200" height="200" /> 7Just use:
<img src="Assets/icon.png" width="200"> instead of:
 4If you are writing MarkDown for PanDoc, you can do this:
{ width=50% } This adds style="width: 50%;" to the HTML <img> tag, or [width=0.5\textwidth] to \includegraphics in LaTeX.
Combining two answers I came out with a solution, that might not look that pretty,
but It works!
It creates a thumbnail with a specific size that might be clicked to brings you to the max resolutions image.
[<img src="image.png" width="250"/>](image.png) Here's an example! I tested it on Visual Code and Github. 
Thanks for feedback we know that this also works on:
- GitLab
- Jupyter Notebook
Maybe this has recently changed but the Kramdown docs show a simple solution.
From the docs
Here is an inline {:height="36px" width="36px"}. And here is a referenced ![smile] [smile]: smile.png {: height="36px" width="36px"} Works on github with Jekyll and Kramdown.
6Replace  with <img src="" width="200" height="200">
One might draw on the alt attribute that can be set in almost all Markdown implementations/renderes together with CSS-selectors based on attribute values. The advantage is that one can easily define a whole set of different picture sizes (and further attributes).
Markdown:
 CSS:
img[alt="minipic"] { max-width: 20px; display: block; } 3If you are using kramdown, you can do this:
{:.foo}  Then add this to your Custom CSS:
.foo { text-align: center; width: 100px; } 1Building on from Tiemes answer, if you're using CSS 3 you can use a substring selector:
This selector will match any image with an alt tag that ends with '-fullwidth':
img[alt$="-fullwidth"]{ width: 100%; display: block; } Then you can still use the alt tag for its intended purpose to describe the image.
The Markdown for the above could be something like:
 I've been using this in Ghost markdown, and it has been working well.
2If you are using reference style images in Gihub Flavored Markdown:
Here is an image of tree: ![alt text][tree]{height=400px width=500px} [//]: # (Image References) [tree]: ./images/tree.png "This is a tree" 3For those intereseted in an rmarkdown and knitr solution. There are some ways to resize images in an .rmd file without the use of html:
You can simply specify a width for an image by adding {width=123px}. Don't introduce whitespace in between the brackets:
{width=250px} Another option is to use knitr::include_graphics:
{r, fig.cap="image description", out.width = '50%'} knitr::include_graphics('your-image.png') 3This one works for me it's not in one line but i hope it works for you.
<div> <img src="attachment:image.png" width="500" height="300"/> </div> 1I came here searching for an answer. Some awesome suggestions here. And gold information pointing out that markdown supports HTMl completely!
A good clean solution is always to go with pure html syntax for sure. With the tag.
But I was trying to still stick to the markdown syntax so I tried wrapping it around a tag and added whatever attributes i wanted for the image inside the div tag. And it WORKS!!
<div>![Chilling]()</div> So this way external images are supported!
Just thought I would put this out there as it isn't in any of the answers. :)
1I scripted the simple tag parser for using a custom-size img tag in Jekyll.
{% img /path/to/img.png 100x200 %} You can add the file to the _plugins folder.
I know that this answer is a bit specific, but it might help others in need.
As many photos are uploaded using the Imgur service, you can use the API detailed here to change the size of the photo.
When uploading a photo in a GitHub issue comment, it will be added through Imgur, so this will help a lot if the photo is very big.
Basically, instead of , you would put for medium sized image.
1For all looking for solutions which work in R markdown/ bookdown, these of the previous solutions do/do not work or need slight adaption:
Working
Append
{ width=50% }or{ width=50% height=50% }{ width=50% }{ width=50% height=50% }Important: no comma between width and height – i.e.
{ width=50%, height=30% }won't work!
Append
{ height="36px" width="36px" }{ height="36px" width="36px" }- Note:
{:height="36px" width="36px"}with colon, as from @sayth, seems not to work with R markdown
Not working:
- Append
=WIDTHxHEIGHT- after the URL of the graphic file to resize the image (as from @prosseek)
- neither
=WIDTHxHEIGHTnor=WIDTHonlywork
You could use this one as well with kramdown:
markdown  {:.some-css-class} or
markdown  {:.some-css-class width="200"} This way you can directly add arbitrary attributes to the last html element. To add classes there is a shortcut .class.secondclass.
If you have one image in each md file, one handy way to control image size is:
adding css style as follows:
## Who Invented JSON? `Douglas Crockford` Douglas Crockford originally specified the JSON format in the early 2000s.  <style type="text/css"> img { width: 250px; } </style> and the output will be like: [![enter image description here][1]][1]
If you have more images in each md page, then the handy way to control each image or each customized tag is to define each element in css. For this case for the img tag we could have:
//in css or within style tags: img[alt="Result1"] { width: 100px; } img[alt="Result2"] { width: 200px; } img[alt="Result3"] { width: 400px; } // try in md one of the methods shown below to insert image in your document:
<br/> <img src="" alt="Result1"> <br/> <img src="" alt="Result2"> <br/> <img src="" alt="Result3"> <br/> <br/> in md:<br/>  <br/>  <br/> 
[1]: For those using Markdown on Google Colaboratory, there is no need to have the image uploaded to the session storage folder, or linked on Google Drive. If the image has a URL, and it can be included on the Jupyter notebook, and its size changed as follows:
<img src="" width="500" height="500" /> For R-Markdown, neither of the above solutions worked for me, so I turned to regular LaTeX syntax, which works just fine.
\begin{figure} \includegraphics[width=300pt, height = 125 pt]{drawing.jpg} \end{figure} Then you can use e.g. the \begin{center} statement to center the image.
When using Flask (I am using it with flat pages)... I found that enabling explicitly (was not by default for some reason) 'attr_list' in extensions within the call to markdown does the trick - and then one can use the attributes (very useful also to access CSS - for example...).
FLATPAGES_HTML_RENDERER = prerender_jinja
and the function:
def prerender_jinja(text): prerendered_body = render_template_string(Markup(text)) pygmented_body = markdown.markdown(prerendered_body, extensions=['codehilite', 'fenced_code', 'tables', 'attr_list']) return pygmented_body And then in Markdown:
{: width=200px} 0There is way with add class and css style
![pic][logo]{.classname}
then write down link and css below
[logo]: (picurl) <style type="text/css"> .classname{ width: 200px; } </style> Resizing Markdown Image Attachments in Jupyter Notebook
I'm using jupyter_core-4.4.0 & jupyter notebook.
If you're attaching your images by inserting them into the markdown like this:
 These attachment links don't work:
<img src="attachment:Screen%20Shot%202019-08-06%20at%201.48.10%20PM.png" width="500"/> DO THIS. This does work.
Just add div brackets.
<div> <img src="attachment:Screen%20Shot%202019-08-06%20at%201.48.10%20PM.png" width="500"/> </div> Hope this helps!
1For future reference:
Markdown implementation for Joplin allows controlling the size of imported images in the following manner:
<img src=":/7653a812439451eb1803236687a70ca" width="450"/>
This feature was requested here and as promised by Laurent this has been implemented.
It took me a while to figure the Joplin specific answer.
The addition of relative dimensions to the source URL will be rendered in the majority of Markdown renderers.
We implemented this in Corilla as I think the pattern is one that follows expectations of existing workflows without pushing the user to rely on basic HTML. If your favourite tool doesn't follow a similar pattern it's worth raising a feature request.
Example of syntax:

Example of kitten:
1The sheer <img ... width="50%"> said above, did work on my Github Readme.md document.
However my real issue was, that the image was inside a table cell, just compressing the text in the beside cell. So the other way was to set columns width in Markdown tables, but the solutions did not really seem enough markdownish for my morning.
At last I solved both problems by simply forcing the beside text cell with as much "& nbsp;" as I needed.
I hope this helps. Bye and thanks everybody.
0Via plain backward compatible MD:
 where w, h defines the bounding box to aspect fit into, as eg in Flutter package
Reconsider html workarounds breaking compatibility as people might use native/non-html components/apps to display markdown.
If changing the initial markdown is not an option for you, this hack might work:
newHtml = oldHtml.replace(/<img/g, '<img height="100"'); I used this to be able to resize images before sending them in an email (as Outlook ignores any image css styling)

