Insert Images in LaTeX: Complete Guide with Examples
Date Published

Inserting Images in LaTeX
Adding images to LaTeX documents requires the graphicx package.
Basic Setup
\usepackage{graphicx}
Optionally specify graphics path:
\graphicspath{{images/}{figures/}}
Basic Image Insertion
\includegraphics{myimage}
LaTeX looks for myimage.pdf, myimage.png, myimage.jpg, etc.
Specifying Size
By Width
\includegraphics[width=0.8\textwidth]{image}
\includegraphics[width=10cm]{image}
By Height
\includegraphics[height=5cm]{image}
Both (may distort)
\includegraphics[width=5cm, height=3cm]{image}
Keep Aspect Ratio
\includegraphics[width=5cm, height=3cm, keepaspectratio]{image}
Scale Factor
\includegraphics[scale=0.5]{image}
The Figure Environment
Wrap images in figure for captions and positioning:
\begin{figure}[h] \centering \includegraphics[width=0.8\textwidth]{image} \caption{This is my caption} \label{fig:myimage} \end{figure}
Positioning Options
[h] — here (approximately) [t] — top of page [b] — bottom of page [p] — separate page for floats [H] — exactly here (requires float package) [!htbp] — try all options
Force Exact Position
\usepackage{float}
\begin{figure}[H] ... \end{figure}
Captions and References
Caption
\caption{Description of the figure}
Short Caption (for list of figures)
\caption[Short]{Long detailed caption}
Label and Reference
\label{fig:myimage}
Reference: Figure \ref{fig:myimage}
Image Manipulation
Rotation
\includegraphics[angle=90]{image}
Trimming/Cropping
\includegraphics[trim=1cm 2cm 1cm 2cm, clip]{image}
Order: left, bottom, right, top
Multiple Images
Side by Side
\begin{figure}[h] \centering \includegraphics[width=0.45\textwidth]{image1} \hfill \includegraphics[width=0.45\textwidth]{image2} \caption{Two images side by side} \end{figure}
Subfigures
\usepackage{subcaption}
\begin{figure}[h] \centering \begin{subfigure}{0.45\textwidth} \includegraphics[width=\textwidth]{image1} \caption{First image} \end{subfigure} \hfill \begin{subfigure}{0.45\textwidth} \includegraphics[width=\textwidth]{image2} \caption{Second image} \end{subfigure} \caption{Main caption} \end{figure}
Supported Formats
pdfLaTeX
- PDF (preferred for vector graphics) - PNG (for raster images) - JPG (for photos)
XeLaTeX/LuaLaTeX
Same as pdfLaTeX.
LaTeX → DVI → PS
- EPS only
Best Practices
1. Use vector graphics (PDF) when possible 2. High resolution (300+ DPI) for raster 3. Consistent sizing across figures 4. Meaningful captions that explain the figure 5. Reference all figures in the text
Common Problems
Image not found: Check path and file extension
Image too large: Reduce width or scale
Image in wrong place: Use float package with [H]
Blurry image: Use higher resolution source
Insert Images with Octree
Octree simplifies image handling:
- Drag-and-drop upload - Automatic path management - Real-time preview - AI helps with positioning
Try it at https://useoctree.com

How to insert PDF files and pages into LaTeX documents. Learn pdfpages package for including external PDFs in your work.

Fix LaTeX PDFs that wont update after changes. Covers browser cache, aux file corruption, compilation errors, and more with step-by-step solutions.