I have tried


But this returns the error

ERROR: Package pdftex.def Error: File
not found.

Are there other options?

  • 13
    ConTeXt supports this natively. \externalfigure[http://www.site.com/path/to/figure.png] just works. Behind the scenes, ConTeXt downloads the file to the luatex cache once, and from then on just reuses the figure.
    – Aditya
    Commented Nov 16, 2010 at 4:36
  • 2
    do you want to add this as an answer? That way, I can select it. Commented Nov 16, 2010 at 5:07

5 Answers 5


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

\usepackage{graphicx} % includegraphics command is implemented here

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


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
  • could you please provide example code in your answer? I did not realize that it was possible to use bash code within latex, although I do use Sweave so I can understand the principle. Commented Nov 15, 2010 at 22:04
  • nice! I guess that this underscores the point that I only need to download the image once in any case. But this approach seems like it would help with portability. Commented Nov 16, 2010 at 3:09
  • 26
    \IfFileExists{image.png}{}{\write18{...}} would help with the only-downloading-once problem. Commented Nov 16, 2010 at 9:06
  • 1
    Could this be done programmatically somehow, maybe with a \renewcommand such that includegraphics can just take the url as an argument?
    – cboettig
    Commented Oct 9, 2012 at 1:23

Short answer: no. You will need to download the image and use it locally if you want to include it in your document. pdfTeX and XeTeX do not include the necessary code to grab an image from an arbitrary location.

Of course, you can link to an image at at remote location. You can make use of the hyperref package to include a suitable link. You might do this using a bit of text:

\href{http://somewhere.com/someplace/some.jpg}{picture here}

or by downloading a local copy and then pointing to the online version


I note from the comments that LuaTeX does include the necessary library to download a copy of an image itself. That would make inclusion possible directly, but I don't know of a pre-build solution for LuaLaTeX. I guess that would be a separate answer in any case.

  • I am not sure if I understand, it seems to me that your short answer contradicts your second answer. And, could you please provide an example of how can I use hyperref to do this? Commented Nov 16, 2010 at 3:07
  • @David: I've added a bit more detail
    – Joseph Wright
    Commented Nov 16, 2010 at 7:07
  • 1
    I'm trying this kind of reference, but it seems to fail - has the relevant functionality been removed? (I'm getting a "some.jpg is missing" error) Commented May 14, 2013 at 17:48

(Copying from the comments section)

ConTeXt supports this natively:


The following:


just works. Behind the scenes, ConTeXt downloads the file to the luatex cache once, and from then on just reuses the figure.

My additional notes:

  • If you have MacTeX, you don't need to do any extra installation. Just change the typesetting option inside your TeX editor.
  • I couldn't get this to work in TeXShop, but it works fine in TeXWorks. Also, I had to use ConTeXt (LuaTeX). It didn't work when I tried ConTeXt (pdfTeX).
  • Well, this doesn't answer the question which is about embedding a remote image file using LaTeX.
    – AlexG
    Commented Jan 5, 2016 at 8:06
  • But it does solve what the user is trying to do, which he explicitly said he is happy to mark as correct. And I started using ConTeXt as a result of what the comment said. Please read up on the XY problem (meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Commented Jan 10, 2016 at 7:36

I just added this option in the v2.3 of robust-externalize (if CTAN does not come with it by default, you can just download the .sty file at the root of your project):


\robExtConfigure{enable fallback to manual mode} % Optional, but prints instructions if shell-escape is disabled instead of giving a compilation error.


Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/303}. 


Make sure to compile the first time with pdflatex -shell-escape foo.tex (or manually run the generated bash script if you do not want to enable shell escape), once the image is downloaded you do not need shell escape anymore (since the image is cached in the robustExternalize folder). Note that you can remove all cached pictures which are not used anymore by running python robExt-remove-old-figures.py.

By default, it uses wget in linux and curl in windows (installed by default starting from Windows 10 I think), but this can easily be customized. Cf documentation for details.


For some reason, the SE bot revived this question after 13 years! I notice that none of the previous answers and comments mentions something vital: possible copyright infringement.

Even though (depending on compiler, recency of software, platform, etc.) it is sometimes possible to pull a web image into the document, and even though it is almost always possible to place a locally downloaded image in the document, that image is likely to be the copyrighted work of someone else. The copyright holder may or may not (usually not) grant a license for usage. Just because you can see it freely, does not mean that you can use it, free or not.

Even if the image does not have a copyright notice as its caption, and even if the web page says nothing, does not mean that it is free. You should look through the web site, to see if there is anything that specifically allows you do download and use any content (such as images). Unless there is an explicit declaration of copyright by someone who can be identified, and that copyright holder grants you explicit license to use it for your purpose, then do not use it.

You may still provide a hyperlink, because this does not involve copying the content. But be aware that links change. What's to stop some prankster from posting an equation, then later changing that image to something naughty?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .