75

Is it possible to prevent the contents of a figure from being rendered? I have a large book document, and to speed up compiling while working on a draft, I would like to have some way of ignoring the content of the images, but ensuring that the figure size remains.

In several cases I am using a line like:

\includegraphics[width=\linewidth]{figure.pdf}  

so I do not know the actual size of the image.

celenius
  • 5,274

3 Answers3

99

You can either give the draft flag to the documentclass which has other implications as it gives the draft option to packages called (although some of them may ignore it).

Alternatively, calling the graphicx package with the draft option should just do what you want.

\documentclass[draft]{article}

or

\usepackage[draft]{graphicx}

If however, while in draft mode you want to see one of the graphics without adding them all in the output, you can unset the draft mode on a per file basis by setting draft to false as follows:

\includegraphics[draft=false]{image.pdf}
ArTourter
  • 17,315
  • 8
    @celenius: It still reads the correct image size from the image files and generates a dummy placeholder with the same size. There is also the demo option which will not look for any images files and insert some fixed-size replacement. – Martin Scharrer Apr 14 '12 at 14:04
  • 2
    For more on the demo option, please see http://tex.stackexchange.com/questions/21924/suppress-the-processing-of-all-images – 0 _ Aug 14 '14 at 02:22
  • The option [draft]clashes with several other packages like colordviandverbatim`... – Xi'an ні війні Oct 13 '15 at 11:46
8

You can use the package draftfigure to get the same result and modify the display of the switched off figure:

\documentclass{article}

\usepackage{graphicx}
\usepackage[allfiguresdraft]{draftfigure}
\begin{document}
\includegraphics[width=50pt]{example-image-a}

\includegraphics[draft=false,width=50pt]{example-image-b}

\setdf{content={This figure is switched off.}}
\includegraphics[width=50pt]{example-image-c}

\end{document}

enter image description here

lukascbossert
  • 3,015
  • 1
  • 16
  • 37
5

If you are using Overleaf, the draft compile mode stops images from being rendered. This also produces a couple of unharmful warnings.

enter image description here

I hope this helps.

Sami HD
  • 51