Skip to content

Overly large image files, or image files using inappropriate file formats, can significantly prolong the compilation process and potentially cause compile timeouts. This help article outlines some suggestions on handling large image files, and for choosing appropriate image file formats.

For large image files (where each is >1MB in size), we recommend that raster images (including raster PDF images) be resized, say to 1200px wide or high, so that the file sizes are smaller. You can do this with an image manipulation program; or if you're using ImageMagick, you can use the convert command. On MacOS, the sips -Z command is very useful.

Photographic images saved as .png can also result in very large file sizes: .jpg is usually a much more space-efficient format for photographs. Line drawings, plots and diagrams are better saved as .png or .pdf, in general. .pdf images can also compile faster compared to .png files if their file sizes are comparable, as the compile process then doesn't need to call libpng.

In the case of .eps images, we recommend that they be converted to .pdf, as the PDF format often results in a smaller file size while maintaining the vector nature of line drawings. The epstopdf command is handy; you'll need to have GhostScript installed as well.

If you must use .eps images in your project, sometimes the .eps file is unnecessarily large due to a glitch/mis-config with the application that exported them. You can try to modify the export settings; or try just re-processing the file with GhostScript and compare the file sizes:

gs -o outputfile.eps -sDEVICE=epswrite originalfile.eps

If you'd like to shave off some compile/render time while working on your document, you can turn on "draft" mode to make your compilation faster, by writing \documentclass[draft]{…} in your document class declaration. By not rendering the images into the PDF (and a couple of other things), the "draft" option can often help reduce compilation time, which is useful when working on large documents.

You can also turn on/off the graphics for a specific part of the project that you're working on:

\setkeys{Gin}{draft=false}
...any \includegraphics here will be rendered in full glory, so that 
you can check the images in this part of the document..
\setkeys{Gin}{draft}
...any \includegraphics here will just be displayed as a blank frame.

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX