Why Pandoc does not retrieve the image file?

umair durrani picture umair durrani · Jun 7, 2014 · Viewed 15.7k times · Source

On RStudio version 0.98.501 I had a long .Rmd file which was easily converted to html once I clicked KnitHtml button. The Knitting process, as I understand, created several folders including images (some manually added by myself), figures, cache and a knitHtml folder which included final .html file. I recently downloaded RStudio version 0.98.894 (preview release) because I wanted to use more features. Now, when I click knitHtml I get following error:

pandoc.exe: Failed to retrieve C:/Users/durraniu/Documents/Trajectory1/images/vissim-view.png InvalidUrlException "C:/Users/durraniu/Documents/Trajectory1/images/vissim-view.png" "Invalid scheme" Error: pandoc document conversion failed with error 61

I copied all the images including the vissim-view.png as indicated above, from the images folder to the knitHtml folder and clicked the button again. This time it gave the same error related to image file which R would create i.e a plot. I don't know how to resolve this. Please help.

Answer

Megatron picture Megatron · Jan 19, 2016

While there are multiple correct solutions above, I'd like to add that a common cause of this error is syntactical, when the author accidentally wraps the file name in the markdown in quotes:

![my image]("my_image.png")

This will result in pandoc being unable to locate the file. I find this mistake to be easy to make in knitr, since we are intertwining R scripts with markdown.

The correct way to insert the image is:

![my image](my_image.png)