The simplest way to add a photo in LaTeX
To add a photo in LaTeX, you need the graphicx package, which handles images. Put this line in your document's preamble — the section before \begin{document} — and then use the \includegraphics command to place your image where you want it.
The most straightforward approach is to save your photo in the same folder as your LaTeX file, then reference it by filename. LaTeX works with JPG, PNG, and PDF image formats without extra setup.
Here is the exact code you need. In your preamble, add this line:
\usepackage{graphicx}
Then in the body of your document, where you want the photo to appear, type:
\includegraphics{photo.jpg}
Replace "photo.jpg" with your actual filename. LaTeX will insert the image at full size. If your photo is too large or too small, you can resize it — see the section below on sizing images.
Key Takeaways
- Add \usepackage{graphicx} to your preamble before \begin{document} to enable image support.
- Use \includegraphics{filename} to place a photo, and save the image file in the same folder as your LaTeX document.
- Control image size with the width or scale option: \includegraphics[width=3in]{photo.jpg} or \includegraphics[scale=0.5]{photo.jpg}.
- Wrap \includegraphics in a figure environment to add captions, labels, and automatic numbering.
Resizing and positioning your photo
By default, \includegraphics inserts your photo at its original size, which is often too large for a document. You control the size by adding options in square brackets after the command.
To set a specific width, use width= followed by a measurement. For example:
\includegraphics[width=3in]{photo.jpg}
This makes the image 3 inches wide and scales the height automatically to keep the photo's proportions correct. You can also use centimeters: width=8cm. If you want to set the height instead, use height= the same way.
To shrink or enlarge a photo by a percentage, use scale=. For example, \includegraphics[scale=0.5]{photo.jpg} makes the image half its original size. scale=1.5 makes it 50 percent larger.
To center a photo on the page, wrap it in a center environment:
\begin{center} \includegraphics[width=4in]{photo.jpg} \end{center}
Adding captions and labels with the figure environment
When you want to add a caption below your photo or refer to it elsewhere in your document, use the figure environment. This also tells LaTeX to number your images automatically.
Here is the structure:
\begin{figure} \centering \includegraphics[width=4in]{photo.jpg} \caption{A description of your photo} \label{fig:myphoto} \end{figure}
The \centering command centers the image. The \caption{} command adds text below the photo — LaTeX automatically numbers it as "Figure 1", "Figure 2", and so on. The \label{} command lets you reference this figure elsewhere in your document by typing \ref{fig:myphoto}, which will insert the correct figure number automatically.
You can place the figure environment anywhere in your document — LaTeX will move it to a good location on the page to avoid breaking up text awkwardly. If you want the image to stay exactly where you typed it, add an h option: \begin{figure}[h].
Organizing photos in a separate folder
If you have many photos, keeping them in a separate folder makes your project cleaner. To do this, create a folder called images in the same location as your LaTeX file, then move your photos into it.
In your preamble, tell LaTeX where to find images by adding this line after \usepackage{graphicx}:
\graphicspath{{images/}}
Now you can reference photos by filename alone, and LaTeX will look in the images folder automatically:
\includegraphics[width=3in]{photo.jpg}
If you use multiple folders, list them all: \graphicspath{{images/}{photos/}{diagrams/}}. LaTeX searches them in order.
Fixing common photo problems
If LaTeX says it cannot find your image, check three things. First, verify the filename is spelled exactly right, including the file extension — photo.jpg is different from Photo.jpg on most computers. Second, make sure the image file is actually in the same folder as your LaTeX document, or in a folder you listed in \graphicspath. Third, confirm you saved the file after moving or renaming the image.
If your photo appears blurry or pixelated, the image file itself may be low resolution. LaTeX cannot improve a photo's quality — it only displays what is in the file. If the photo looks fine in other programs but blurry in your PDF, try exporting it again at a higher resolution or using a PNG file instead of JPG.
If your image is rotated the wrong way, use the angle= option to rotate it. For example, \includegraphics[width=3in,angle=90]{photo.jpg} rotates the image 90 degrees clockwise. Use angle=180 to flip it upside down, or angle=270 for 270 degrees.
Placing multiple photos side by side
To display two or more photos next to each other, use the minipage environment. Each minipage acts as a small column that can hold an image and its own caption.
Here is an example with two photos:
\begin{figure} \begin{minipage}{0.45\textwidth} \centering \includegraphics[width=\linewidth]{photo1.jpg} \caption{First photo} \end{minipage} \hfill \begin{minipage}{0.45\textwidth} \centering \includegraphics[width=\linewidth]{photo2.jpg} \caption{Second photo} \end{minipage} \end{figure}
Each minipage takes up 0.45 of the page width, leaving space between them. The \hfill command spreads them apart evenly. Use width=\linewidth inside the minipage so the image fills the available space. For three photos, change 0.45 to 0.3 for each minipage.
Frequently Asked Questions
What image formats does LaTeX accept?
LaTeX handles JPG, PNG, and PDF files without extra setup. If you have a different format like GIF or BMP, convert it to PNG or JPG first using an image editor or an online converter. PDF images are useful when you want to include diagrams or other vector graphics.
Can I add a border or frame around my photo?
Yes. Wrap \includegraphics in a \fbox command: \fbox{\includegraphics[width=3in]{photo.jpg}}. This adds a thin black border. For more control over the border style, use the fancybox package and its \shadowbox or \doublebox commands.
How do I make text wrap around a photo?
Use the wrapfig package. Add \usepackage{wrapfig} to your preamble, then wrap your image in a wrapfigure environment: \begin{wrapfigure}{r}{3in} places the image on the right side with 3 inches of width, and text flows around it. Use {l} for left alignment.
Why is my photo appearing on a different page than where I typed it?
LaTeX moves figures to optimize page layout and avoid leaving large blank spaces. If you need the image to stay exactly where you typed it, add the [h] option: \begin{figure}[h]. For even stricter placement, use [H] (which requires the float package), but this can create awkward spacing.
Can I add a photo to the header or footer of my document?
Yes, using the fancyhdr package. Add \usepackage{fancyhdr} to your preamble, then use \lhead{\includegraphics[height=0.5in]{logo.jpg}} to place an image in the left header. Use \chead for center and \rhead for right. Keep header images small so they do not interfere with text.