Adam Smith Adam Smith - 1 year ago 121
Markdown Question

How to set size for local image using knitr for markdown?

I have a local image that I would like to include in an

file which I will then
and convert to HTML slides with
. Per this post, this will insert the local image :

![Image Title](path/to/your/image)

Is there a way to modify this code to also set the image size?

Answer Source

You can also read the image using png package for example and plot it like a regular plot using grid.raster from the grid package.

```{r fig.width=1, fig.height=10,echo=FALSE}
img <- readPNG("path/to/your/image")

With this method you have full control of the size of you image.