# Using the Insert figure button

{% hint style="warning" %}
Before using any of these figure-creation methods, make sure your main LaTeX file has loaded the `graphicx` package by writing `\usepackage{graphicx}` within its [preamble](/getting-started/latex-tutorials.md).
{% endhint %}

You can use the following steps to insert a figure into an Overleaf LaTeX document.

1. Choose which editor you want to use: Visual Editor or Code Editor.
2. Select the Insert Figure button (<img src="/files/jfI0I7XMFa5TX1bT6Pqe" alt="The Insert Figure button on the editor toolbar" data-size="line">) to display a list of options for inserting figures:<br>

   <figure><img src="/files/7EzNoptIHjTN6gMSfZdF" alt="List of options for inserting a figure"><figcaption></figcaption></figure>

## Upload from computer

This option creates a figure using a graphics file uploaded from your device.

<figure><img src="/files/4sxqU6fJXU2tCrpMLgb8" alt="The upload from computer modal displayed when you upload a file"><figcaption></figcaption></figure>

To use this option:

1. Upload a graphic using one of these methods:
   * drag and drop a graphics file onto the modal window (within the area shown).
   * paste an image into the modal window (within the area shown).
   * manually select a file located on your device
2. Give the graphics file a name.
3. (Optional) Choose a project folder in which to save the file.
4. Decide whether to use a figure caption.
5. Decide whether to include a label (used for [referencing the figure](https://www.overleaf.com/learn/latex/Inserting_Images%23Labels_and_cross-references#Labels_and_cross-references)).
6. Set the image width (as a fraction of `\linewidth`).
7. Select **Insert figure** to upload the graphic and automatically generate a LaTeX `figure` environment based on your choices.

## From project files

This option creates a figure using one of the graphics files previously uploaded to your current project.

<figure><img src="/files/sbQuKKlbibdfeAndU7u1" alt="The insert from project files modal used to select a project file for creating a figure"><figcaption></figcaption></figure>

To use this option:

1. Choose a graphic contained in your project.
2. Decide whether to use a figure caption.
3. Decide whether to include a label (used for [referencing the figure](https://www.overleaf.com/learn/latex/Inserting_Images%23Labels_and_cross-references#Labels_and_cross-references)).
4. Set the image width (as a fraction of `\linewidth`).
5. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

## From another project

This option lets you create figures using graphics files contained in another one of your Overleaf projects. As shown in the animated screenshot below, you select a project then choose a file previously *uploaded* to that project, or a file *output* (generated) by that project—for example, a PDF graphic generated by [externalizing TikZ graphics](https://learn.overleaf.com/learn/Questions/I_have_a_lot_of_tikz,_matlab2tikz_or_pgfplots_figures,_so_I%27m_getting_a_compilation_timeout._Can_I_externalise_my_figures%3F#How_to_externalize_TikZ_graphics). See the section [Select from output files](https://learn.overleaf.com/learn/Kb/How_to_insert_figures_in_Overleaf#Select_from_output_files) for a video clip showing how to use an output file created by another project.

<figure><img src="https://images.ctfassets.net/nrgyaltdicpt/3rqcEVXmynvMgsWqOZwru2/41f3123bb8491d46f8722884195d5e4d/SelectOutputFile.gif" alt="An animated GIF showing how to choose file generated by another project"><figcaption></figcaption></figure>

To use this option:

1. Choose a project containing graphics files you’d like to use in your current project.
2. Select one of that project’s graphics:
   * an **image file** *uploaded to* that project, or
   * an [**output file**](https://learn.overleaf.com/learn/Kb/How_to_insert_figures_in_Overleaf#Select_from_output_files) *generated by* that project.
3. Give the graphics file a name.
4. (Optional) Choose a project folder in which to save the file.
5. Decide whether to use a figure caption.
6. Decide whether to include a label (used for [referencing the figure](https://www.overleaf.com/learn/latex/Inserting_Images%23Labels_and_cross-references#Labels_and_cross-references)).
7. Set the image width (as a fraction of `\linewidth`).
8. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

### **Select from output files**

Instead of choosing a file that you have uploaded to another project, you can choose to include a file that is generated by another project when that other project is compiled.

This is an advanced option that allows you to offload some of the compilation work required to generate some image types.

The video clip below walks you through the process of incorporating a figure into your current project, utilizing a file generated from another project that creates [externalized TikZ graphics](https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_tikz%2C_matlab2tikz_or_pgfplots_figures%2C_so_I'm_getting_a_compilation_timeout._Can_I_externalise_my_figures%3F#How_to_externalize_TikZ_graphics).

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/1hcdCRW7PFioG58vexEMpf/60b86288419fea290ad4b43a633afda3/FigureFromExternalProjectFile.mp4>" %}

## From URL

This option lets you create figures using graphics added (downloaded) to your project via a URL.

<figure><img src="/files/sdbqR6qqUOFmqTdfXF9z" alt="An image showing the modal window for downloading a file via a URL"><figcaption></figcaption></figure>

To use this option:

1. Paste a [direct download link](https://en.wikipedia.org/wiki/Direct_download_link) (URL) into the **Image URL** field.
2. Give the graphics file a name.
3. (Optional) Choose a project folder in which to save it.
4. Decide whether to include a figure caption.
5. Decide whether to include a label (used for [referencing the figure](https://www.overleaf.com/learn/latex/Inserting_Images%23Labels_and_cross-references#Labels_and_cross-references)).
6. Set the image width (as a fraction of `\linewidth`).
7. Select **Insert figure** to automatically generate a LaTeX `figure` environment based on your choices.

The following video clip demonstrates using a [Google Drive download URL](https://learn.overleaf.com/learn/Kb/How_can_I_upload_files_from_Google_Drive%3F). It also shows how to change the figure size and give it a caption.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/29hcjGmsEQewhuCVQaWkSr/2cef229050a36a87b86dc0aabdde2858/InsertFigureURL.mp4>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overleaf.com/writing-and-editing/inserting-images/using-the-insert-figure-button.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
