Intermediate 16 min read

LaTeX Figures and Images: Complete Guide with Examples

Learn how to insert, position, and format images in LaTeX documents. Master the includegraphics command, figure environment, image scaling, subfigures, text wrapping, and supported image formats with practical, real-world examples.

Introduction to LaTeX Figures

Images and figures are essential components of professional documents, whether you're writing academic papers, technical reports, presentations, or creating resumes. LaTeX provides powerful tools for inserting and managing images with precise control over positioning, sizing, and formatting.

Unlike word processors where you drag and drop images, LaTeX uses a more systematic approach through the graphicx package and the figure environment. This might seem complex initially, but it provides superior control and ensures consistent, professional results across your entire document.

Why Use LaTeX for Images? LaTeX offers automatic numbering, cross-referencing, consistent positioning, optimal placement to avoid awkward page breaks, and the ability to generate lists of figures. Images maintain quality and position across document revisions without manual adjustment.

The graphicx Package

The graphicx package is the standard package for including images in LaTeX documents. It provides the \includegraphics command and various options for image manipulation.

Loading the Package

Preamble Setup
\documentclass{article}
\usepackage{graphicx}

% Optional: Specify graphics path
\graphicspath{{images/}{figures/}{./}}

\begin{document}
% Your content with images
\end{document}

Setting Graphics Path

The \graphicspath command tells LaTeX where to look for image files. This is optional but highly recommended for organizing your project:

Graphics Path Configuration
% Single directory
\graphicspath{{images/}}

% Multiple directories
\graphicspath{{images/}{figures/}{photos/}}

% Current directory (default)
\graphicspath{{./}}

Project Structure Recommendation:

my-document/
├── main.tex
├── images/
│   ├── logo.png
│   ├── chart.pdf
│   └── photo.jpg
└── output/
    └── main.pdf

Inserting a Basic Image

The simplest way to insert an image is using \includegraphics{filename}. The file extension is optional—LaTeX will search for supported formats.

Minimal Example

basic_image.tex
\documentclass{article}
\usepackage{graphicx}

\begin{document}

\section{Introduction}
Here is our company logo:

\includegraphics{logo.png}

\end{document}

With File Path

image_with_path.tex
% Relative path
\includegraphics{images/logo.png}

% Subdirectory
\includegraphics{figures/chapter1/diagram.pdf}

% Without extension (LaTeX finds it)
\includegraphics{images/logo}
File Path Rules: Use forward slashes (/) even on Windows. Avoid spaces and special characters in file names. Use relative paths from your .tex file location. For best compatibility, stick to lowercase letters, numbers, hyphens, and underscores in filenames.

Scaling and Resizing Images

LaTeX provides multiple ways to control image size. Choose the method that best fits your needs:

Width-Based Scaling

width_scaling.tex
% Fixed width
\includegraphics[width=5cm]{image.png}

% Width relative to text width
\includegraphics[width=0.5\textwidth]{image.png}

% Width relative to line width (in columns)
\includegraphics[width=0.8\linewidth]{image.png}

% Full text width
\includegraphics[width=\textwidth]{image.png}

Height-Based Scaling

height_scaling.tex
% Fixed height
\includegraphics[height=4cm]{image.png}

% Height relative to text height
\includegraphics[height=0.3\textheight]{image.png}

Scale Factor

scale_factor.tex
% 50% of original size
\includegraphics[scale=0.5]{image.png}

% 150% of original size
\includegraphics[scale=1.5]{image.png}

% 200% (double size)
\includegraphics[scale=2.0]{image.png}

Keeping Aspect Ratio

aspect_ratio.tex
% Set width, height adjusts automatically (maintains aspect ratio)
\includegraphics[width=8cm]{image.png}

% Set both width and height (may distort image)
\includegraphics[width=8cm,height=6cm]{image.png}

% Keep aspect ratio with max dimensions
\includegraphics[width=8cm,height=6cm,keepaspectratio]{image.png}

Common Sizing Options Comparison

Option Description Example Use Case
width=0.5\textwidth Half the text width Side-by-side images
width=\textwidth Full text width Wide figures, charts
scale=0.8 80% of original size Slightly smaller image
height=4cm Fixed height of 4cm Consistent image heights
height=0.3\textheight 30% of page height Tall images, portraits
Best Practice: Use relative sizing (\textwidth, \linewidth) instead of absolute sizes (cm, in) for better document flexibility. If you change margins or document class, relative sizes adapt automatically.

Figure Environment and Positioning

The figure environment provides a floating container for images, allowing LaTeX to position them optimally and add captions and labels.

Basic Figure Environment

figure_environment.tex
\begin{figure}[h]
    \centering
    \includegraphics[width=0.6\textwidth]{diagram.png}
    \caption{System Architecture Diagram}
    \label{fig:architecture}
\end{figure}

See Figure \ref{fig:architecture} for details.

Positioning Options

The optional parameter controls where LaTeX tries to place the figure:

Specifier Permission Description
h here Place approximately here in the text
t top At the top of a page
b bottom At the bottom of a page
p page On a special page for floats only
! override Override internal parameters LaTeX uses
H HERE Exactly here (needs \usepackage{float})

Positioning Examples

positioning_examples.tex
% Try here, then top, then bottom, then separate page
\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.7\textwidth]{chart.pdf}
    \caption{Sales Data}
\end{figure}

% Force exactly here (requires float package)
\usepackage{float}
\begin{figure}[H]
    \centering
    \includegraphics[width=0.5\textwidth]{logo.png}
    \caption{Company Logo}
\end{figure}

% Top of page, overriding restrictions
\begin{figure}[!t]
    \centering
    \includegraphics[width=\textwidth]{banner.png}
    \caption{Header Banner}
\end{figure}

Alignment Options

alignment.tex
% Centered (most common)
\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{image.png}
\end{figure}

% Left-aligned
\begin{figure}[h]
    \raggedright
    \includegraphics[width=0.5\textwidth]{image.png}
\end{figure}

% Right-aligned
\begin{figure}[h]
    \raggedleft
    \includegraphics[width=0.5\textwidth]{image.png}
\end{figure}

Captions and Cross-References

Captions describe your figures, and labels allow you to reference them elsewhere in your document. LaTeX automatically numbers figures and updates references.

Basic Caption

basic_caption.tex
\begin{figure}[h]
    \centering
    \includegraphics[width=0.6\textwidth]{graph.png}
    \caption{Monthly Revenue Growth (2020-2026)}
    \label{fig:revenue}
\end{figure}

As shown in Figure \ref{fig:revenue}, revenue increased by 45\%.

Short Caption for List of Figures

short_caption.tex
% Short caption appears in List of Figures
% Long caption appears below figure
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{complex-diagram.png}
    \caption[System Architecture]{Detailed System Architecture 
    showing all microservices, databases, and external integrations}
    \label{fig:architecture}
\end{figure}

% Generate list of figures
\listoffigures

Caption Above Image

caption_above.tex
% Simply place \caption before \includegraphics
\begin{figure}[h]
    \centering
    \caption{Experimental Setup}
    \includegraphics[width=0.7\textwidth]{setup.jpg}
    \label{fig:setup}
\end{figure}

Caption Customization

caption_customization.tex
\usepackage{caption}

% Customize caption format
\captionsetup{
    font=small,
    labelfont=bf,
    format=hang,
    justification=centering
}

% Or customize individual figures
\begin{figure}[h]
    \centering
    \includegraphics[width=0.6\textwidth]{image.png}
    \captionsetup{font=footnotesize,labelfont=it}
    \caption{This caption uses custom formatting}
\end{figure}

Cross-Referencing

cross_references.tex
% Define figure with label
\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{results.png}
    \caption{Experimental Results}
    \label{fig:results}
\end{figure}

% Reference the figure
See Figure \ref{fig:results} on page \pageref{fig:results}.

% With hyperref package for clickable links
\usepackage{hyperref}
See \autoref{fig:results} for details. % Prints "Figure 1"

Multiple Images and Subfigures

Display multiple related images together using the subcaption or subfigure package. This is perfect for comparisons or sequences.

Side-by-Side Images (Simple)

side_by_side.tex
\begin{figure}[h]
    \centering
    \includegraphics[width=0.45\textwidth]{before.png}
    \hfill % Horizontal space between images
    \includegraphics[width=0.45\textwidth]{after.png}
    \caption{Before and After Comparison}
    \label{fig:comparison}
\end{figure}

Subfigures with Subcaptions

subfigures.tex
\usepackage{subcaption}

\begin{figure}[h]
    \centering
    
    \begin{subfigure}[b]{0.45\textwidth}
        \centering
        \includegraphics[width=\textwidth]{image1.png}
        \caption{First experiment}
        \label{fig:sub1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\textwidth}
        \centering
        \includegraphics[width=\textwidth]{image2.png}
        \caption{Second experiment}
        \label{fig:sub2}
    \end{subfigure}
    
    \caption{Experimental Results Comparison}
    \label{fig:experiments}
\end{figure}

% Reference subfigures
See Figure \ref{fig:experiments} for both results, specifically 
\ref{fig:sub1} and \ref{fig:sub2}.

Grid of Images

image_grid.tex
\usepackage{subcaption}

\begin{figure}[h]
    \centering
    
    % First row
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img1.png}
        \caption{Image 1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img2.png}
        \caption{Image 2}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img3.png}
        \caption{Image 3}
    \end{subfigure}
    
    % Second row
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img4.png}
        \caption{Image 4}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img5.png}
        \caption{Image 5}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{img6.png}
        \caption{Image 6}
    \end{subfigure}
    
    \caption{Process Steps Overview}
\end{figure}

Subfigures with Custom Labels

custom_subfigure_labels.tex
\usepackage{subcaption}

% Customize subfigure labels (default is (a), (b), (c))
\captionsetup[subfigure]{labelformat=simple, labelsep=colon}
\renewcommand\thesubfigure{\Roman{subfigure}}

\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.45\textwidth}
        \includegraphics[width=\textwidth]{step1.png}
        \caption{Initial State}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\textwidth}
        \includegraphics[width=\textwidth]{step2.png}
        \caption{Final State}
    \end{subfigure}
    \caption{Process Flow}
\end{figure}
% Labels will be (I), (II) instead of (a), (b)

Wrapping Text Around Figures

The wrapfig package allows text to flow around figures, creating a magazine-style layout. This is perfect for small images in text-heavy sections.

Basic Text Wrapping

wrapfigure.tex
\usepackage{wrapfig}

\begin{wrapfigure}{r}{0.4\textwidth}
    \centering
    \includegraphics[width=0.35\textwidth]{profile.jpg}
    \caption{Team Leader}
\end{wrapfigure}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
The text flows around the image naturally. Sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim 
ad minim veniam, quis nostrud exercitation ullamco laboris.

Duis aute irure dolor in reprehenderit in voluptate velit 
esse cillum dolore eu fugiat nulla pariatur. The image stays 
in place while text wraps around it beautifully.

Wrapfigure Options

Position Description Example
r or R Right side of text {r}{0.4\textwidth}
l or L Left side of text {l}{0.4\textwidth}
i or I Inner edge (inside margin) {i}{0.4\textwidth}
o or O Outer edge (outside margin) {o}{0.4\textwidth}

Wrapping with Line Control

wrap_with_lines.tex
% Syntax: {position}[number of lines]{width}
\begin{wrapfigure}[12]{r}{0.35\textwidth}
    \centering
    \includegraphics[width=0.3\textwidth]{icon.png}
    \caption{Icon}
\end{wrapfigure}

% The [12] specifies that 12 lines of text will wrap around the figure
Your text content here...
Wrapfig Limitations: Don't use wrapfigure inside lists, at page boundaries, or with other floating environments. It works best in the middle of paragraphs with sufficient text. If you have issues, try adjusting the figure width or number of wrapped lines.

Rotating Images

The graphicx package includes rotation capabilities for images that need to be rotated or placed in landscape orientation.

Rotating Images

rotate_image.tex
% Rotate 90 degrees counterclockwise
\includegraphics[angle=90,width=0.5\textwidth]{image.png}

% Rotate 45 degrees
\includegraphics[angle=45,scale=0.8]{image.png}

% Rotate 270 degrees (= 90 degrees clockwise)
\includegraphics[angle=270,width=\textwidth]{wide-chart.pdf}

Landscape Page with Rotated Figure

landscape_figure.tex
\usepackage{pdflscape}

% Entire page in landscape orientation
\begin{landscape}
    \begin{figure}[h]
        \centering
        \includegraphics[width=0.9\linewidth]{wide-diagram.pdf}
        \caption{Wide Process Diagram}
        \label{fig:process}
    \end{figure}
\end{landscape}

Rotating Figure Environment

sidewaysfigure.tex
\usepackage{rotating}

% Figure rotated 90 degrees, placed on separate page
\begin{sidewaysfigure}
    \centering
    \includegraphics[width=0.85\textheight]{tall-chart.pdf}
    \caption{Vertical Timeline}
    \label{fig:timeline}
\end{sidewaysfigure}

Supported Image Formats

LaTeX supports various image formats, and the choice depends on your compilation method and image type.

Format Compatibility

Format pdfLaTeX LaTeX → DVI Best For
PDF ✅ Yes ❌ No Vector graphics, diagrams, plots
PNG ✅ Yes ❌ No Screenshots, logos, web graphics
JPG/JPEG ✅ Yes ❌ No Photographs, complex images
EPS ⚠️ With epstopdf ✅ Yes Legacy vector graphics
SVG ⚠️ With svg package ❌ No Scalable web graphics (needs conversion)

Recommended Formats by Use Case

Plots and Graphs

Use PDF - Vector format that scales perfectly at any size without quality loss. Export from MATLAB, Python (matplotlib), R, Excel.

Photographs

Use JPG - Efficient compression for photos. Resolution: 300 DPI for print, 150 DPI for screen-only documents.

Logos and Icons

Use PNG or PDF - PNG for transparency, PDF for scalability. Avoid JPG for logos (compression artifacts).

Screenshots

Use PNG - Lossless compression preserves text clarity. Crop and resize before including.

Converting Image Formats

Converting EPS to PDF
% Automatically convert EPS to PDF
\usepackage{epstopdf}

% Now you can use .eps files in pdflatex
\includegraphics{diagram.eps}
Using SVG Files
% Requires Inkscape installed
\usepackage{svg}

% SVG automatically converted to PDF
\includesvg{diagram.svg}

% With options
\includesvg[width=0.8\textwidth]{diagram.svg}

Images in Resumes

Images in resumes typically include profile photos, company logos, icons, and QR codes. Here's how to incorporate them effectively:

Profile Photo

resume_photo.tex
% Circular profile photo
\usepackage{tikz}

\begin{tikzpicture}
    \clip (0,0) circle (1.5cm);
    \node at (0,0) {\includegraphics[width=3cm]{profile.jpg}};
\end{tikzpicture}

% Or simple rectangular photo
\includegraphics[width=3cm,height=4cm,keepaspectratio]{photo.jpg}

Company Logo in Experience Section

company_logo.tex
% Inline logo with text
\textbf{Senior Developer} at 
\includegraphics[height=1em,valign=c]{company-logo.png} 
\textbf{Tech Company}

% Requires graphicx and adjustbox packages
\usepackage{graphicx}
\usepackage{adjustbox}

Skill Icons

skill_icons.tex
% Skills with icons
\textbf{Technical Skills:}\\
\includegraphics[height=1.2em]{python-icon.png} Python
\hspace{1em}
\includegraphics[height=1.2em]{js-icon.png} JavaScript
\hspace{1em}
\includegraphics[height=1.2em]{docker-icon.png} Docker
\hspace{1em}
\includegraphics[height=1.2em]{aws-icon.png} AWS

QR Code for Portfolio

qr_code.tex
% In resume header or footer
\begin{minipage}{0.7\textwidth}
    \textbf{John Doe}\\
    Software Engineer\\
    john@example.com | +1-234-567-8900
\end{minipage}
\hfill
\begin{minipage}{0.2\textwidth}
    \raggedleft
    \includegraphics[width=2cm]{portfolio-qr.png}\\
    {\small Scan for Portfolio}
\end{minipage}

Professional Resume Templates with Images

Browse our LaTeX resume templates with pre-configured image layouts:

  • Awesome CV - Modern design with profile photo
  • AltaCV - Sidebar with photo and icons
  • Modern CV - Classic style with photo option

Troubleshooting Common Issues

Image Not Found Error

Error: ! LaTeX Error: File 'image.png' not found.

Solutions:

  • Check file path is correct (use forward slashes /)
  • Verify file exists in specified location
  • Check file extension matches actual file type
  • Use \graphicspath{{images/}} to set image directory
  • Ensure no spaces in filename
Image Too Large or Small

Problem: Image doesn't fit properly on page

Solutions:

% Too large - scale down
\includegraphics[width=0.8\textwidth]{large-image.png}

% Too small - scale up
\includegraphics[width=\textwidth]{small-image.png}

% Maintain aspect ratio
\includegraphics[width=8cm,height=6cm,keepaspectratio]{image.png}
Figure Appears in Wrong Place

Problem: LaTeX moves figure far from where you defined it

Solutions:

  • Use [H] for exact placement (requires \usepackage{float})
  • Use [!htbp] to give LaTeX more flexibility
  • Reduce figure size if it doesn't fit on current page
  • Place figure closer to where it's first referenced
  • Use \FloatBarrier from placeins package to stop floating past a point
Blurry or Low-Quality Image

Problem: Image appears pixelated in PDF

Solutions:

  • Use higher resolution source image (300 DPI for print)
  • Use vector formats (PDF, SVG) instead of raster (PNG, JPG)
  • Don't scale images up beyond original size
  • Export plots/graphs directly to PDF from software
Caption Numbering Issues

Problem: Figure numbers are wrong or missing

Solutions:

  • Compile document twice for proper numbering
  • Ensure \caption is inside figure environment
  • Check \label comes after \caption
  • Delete auxiliary files (.aux) and recompile if numbers stuck
EPS Files Not Working in pdfLaTeX

Problem: EPS images don't compile with pdfLaTeX

Solution:

% Add to preamble
\usepackage{epstopdf}

% EPS files automatically converted to PDF
\includegraphics{diagram.eps}

Frequently Asked Questions

How do I insert an image in LaTeX?

First, add \usepackage{graphicx} to your preamble. Then use \includegraphics{filename} to insert the image. For better control, wrap it in a figure environment: \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{image.png} \caption{Description} \end{figure}

What image formats does LaTeX support?

pdfLaTeX supports PDF, PNG, JPG/JPEG natively. EPS files require the epstopdf package for automatic conversion. SVG files need the svg package (requires Inkscape). Use PDF for vector graphics (plots, diagrams), PNG for screenshots and logos, and JPG for photographs. PDF format is recommended whenever possible for scalability.

How do I resize images in LaTeX?

Use options in \includegraphics: [width=0.5\textwidth] for half text width, [height=4cm] for fixed height, [scale=0.8] for 80% of original size, or [width=8cm,height=6cm,keepaspectratio] to fit within dimensions while maintaining aspect ratio. Relative sizing (\textwidth, \linewidth) is preferred for document flexibility.

How do I center an image in LaTeX?

Use \centering inside the figure environment: \begin{figure}[h] \centering \includegraphics{image.png} \end{figure}. Alternatively, use the center environment: \begin{center} \includegraphics{image.png} \end{center}. The \centering command is preferred as it doesn't add extra vertical space.

How do I put two images side by side in LaTeX?

Use \hfill between images: \includegraphics[width=0.45\textwidth]{img1.png} \hfill \includegraphics[width=0.45\textwidth]{img2.png}. For separate captions, use the subcaption package with subfigure environments. Make sure combined widths don't exceed \textwidth (use 0.45 to leave space between images).

How do I control where figures appear in LaTeX?

Use positioning specifiers in \begin{figure}[specifier]: [h] for here, [t] for top, [b] for bottom, [p] for separate page. Combine them like [htbp] to give LaTeX options. For exact positioning, use [H] (requires \usepackage{float}). LaTeX may override your preferences to maintain good page layout; [H] forces exact placement but may create spacing issues.

How do I add a caption to an image in LaTeX?

Use \caption{Your caption text} inside the figure environment. Add \label{fig:yourlabel} after the caption to enable cross-references. For short captions in List of Figures: \caption[Short title]{Long descriptive caption}. The caption command automatically numbers figures and allows you to reference them with \ref{fig:yourlabel}.

How do I wrap text around an image in LaTeX?

Use the wrapfig package: \usepackage{wrapfig} then \begin{wrapfigure}{r}{0.4\textwidth} \includegraphics{image.png} \end{wrapfigure}. Position options: r (right), l (left), i (inner margin), o (outer margin). Place wrapfigure at the start of a paragraph with sufficient text. Don't use inside lists or near page breaks.

Why is my image not showing up in the PDF?

Common causes: (1) File path is incorrect—check spelling and use forward slashes, (2) Image file doesn't exist in specified location, (3) Wrong format for your compiler (EPS with pdflatex), (4) Missing graphicx package in preamble, (5) Image filename has spaces—rename without spaces. Check the log file for specific error messages indicating what went wrong.

How do I rotate an image in LaTeX?

Use the angle option in includegraphics: \includegraphics[angle=90]{image.png} rotates 90 degrees counterclockwise. Combine with sizing: \includegraphics[angle=90,width=0.8\textwidth]{image.png}. For entire page rotation, use \usepackage{pdflscape} with \begin{landscape} environment, or \usepackage{rotating} with sidewaysfigure environment for rotated figures on separate pages.

Create Professional Documents with Images

Use our LaTeX resume templates with perfect image integration

Browse Resume Templates