[Tex/LaTex] use an image located on the web in a LaTeX document

external filesgraphicsonline

I have tried

\includegraphics{http://www.site.com/path/to/figure.png}

But this returns the error

ERROR: Package pdftex.def Error: File
`http://www.website.com/path/to/figure.png'
not found.

Are there other options?

Best Answer

you could use \write18 and a curl or wget script to grab the image from the web and download it to your directory.

\documentclass{article}
\usepackage{graphicx} % includegraphics command is implemented here
\begin{document}

\write18{wget http://www.some-site.com/path/to/image.png}
\includegraphics{image.png}

\end{document}

note however, that recent versions of miktex and texlive come with restricted versions of \write18, and it some cases you must pass an option to latex to enable it, as in:

pdflatex --shell-escape test.tex