> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/latex/zh-cn/zhi-shi-ku/088-including-images-on-overleaf.md).

# 在 Overleaf 中插入图像

在 Overleaf 中编辑文档时，插入图片非常简单。本文将介绍如何从电脑或 URL 将图片上传到项目中，以及如何将它们插入到排版文档中。

## 简单图片上传

|                                                                                            |                                                                        |
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| 要上传图片，在编辑器中前往左上角并点击上传图标 ![Uploadicon.png](/files/94d19b769d4bc1fee1dede77f1dfa13b8ff54e31) | ![V2uploadbutton.png](/files/4e3c454ebf03303e2b90aca1dfcd29155ba50c82) |

|                |                                                                          |
| -------------- | ------------------------------------------------------------------------ |
| 会弹出一个对话框供你上传文件 | ![V2uploaddialogue.png](/files/9d39d0d2b9809df31599705479e2885ef4ac1cb1) |

|                                     |                                                                            |
| ----------------------------------- | -------------------------------------------------------------------------- |
| 在那里你可以拖放文件，或者点击 ***选择文件*** 以打开文件浏览器 | ![UploadingImagesEx3.png](/files/8886de0cf8b09ccbf9fa8622dbb11964fc1d1316) |

|                                                        |                                                                             |
| ------------------------------------------------------ | --------------------------------------------------------------------------- |
| 导航到正确的文件夹并选择要上传的图片。你可以一次上传多个文件。上传过程完成后，你会在左侧面板中看到这些文件。 | ![UploadingImagesEx3b.png](/files/16cb1cdbff133edbd3f8adaa180f24436b2f2a54) |

现在你可以在 LaTeX 文件中使用图片，见下例

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{A project with images}
\author{Overleaf}
\date{}

\begin{document}

\maketitle

\section{Introduction}
\begin{figure}[htp]
    \centering
    \includegraphics[width=4cm]{InsertingImagesEx5}
    \caption{An image of a galaxy}
    \label{fig:galaxy}
\end{figure}

\end{document}
```

![UploadingImagesEx5b.png](/files/be2322e4d5229dc48cd0b98e69adedfdec77a7c1)

注意，图片的文件名只作为参数传入 `\includegraphics[width=4cm]{lion-logo}`

有关 LaTeX 中图片处理的更多信息，请参见 [进一步阅读](#further-reading) ，其中包含指向其他文档页面的链接。

## 将图片上传到文件夹

如果你的项目包含多张图片，你可能需要把它们放在单独的文件夹中，以便保持整洁有序。

|                                                                                                         |                                                                             |
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| 要在 Overleaf 中创建文件夹，请前往编辑器左上角并点击文件夹图标 ![Foldericon.png](/files/1e1359239907b842500ecff018c3ba4d7f63e2a8) | ![UploadingImagesEx6b.png](/files/1a3e1e2c84f4f7c4eab8230e31b5b5807c69a7ef) |

|                                   |                                                                             |
| --------------------------------- | --------------------------------------------------------------------------- |
| 会出现一个输入框，为你的文件夹设置名称，然后点击 ***创建*** | ![UploadingImagesEx7b.png](/files/2f367680991880c27b1e07e80e9349ad0355277b) |

|                                                   |                                                                             |
| ------------------------------------------------- | --------------------------------------------------------------------------- |
| 现在你可以在左侧面板中看到该文件夹。你可以拖放已上传的文件，甚至可以在左侧面板中的文件夹之间拖放。 | ![UploadingImagesEx8b.png](/files/a4dda4df9680d84d14d405625fffdab7fe962302) |

要直接上传文件到某个文件夹，先点击该文件夹，然后点击 ***新建*** 并按照 [上一节](#simple-image-upload).

中的说明进行操作。一旦文件夹中有了一些文件，你就可以在文档中使用它们，见下例。

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{A project with images}
\author{Overleaf}
\date{}

\graphicspath{{Images/}}

\begin{document}

\maketitle

\section{Introduction}
\begin{figure}[htp]
    \centering
    \includegraphics[width=4cm]{InsertingImagesEx5}
    \caption{An image of a galaxy}
    \label{fig:galaxy}
\end{figure}

\end{document}
```

![UploadingImagesEx5b.png](/files/be2322e4d5229dc48cd0b98e69adedfdec77a7c1)

命令 `\graphicspath{ {Images/} }` 告诉 LaTeX 图片存储在 *Images*中，现在你只需在 `\includegraphics`

有关 LaTeX 中图片管理的更多信息，请查看 [进一步阅读](#further-reading) 中的链接。

## 快速指南

* **向 Overleaf 项目中上传一张或多张图片的快速指南：**

在编辑器左上角点击上传图标，然后你可以拖放文件，或者点击“选择文件”浏览本地目录。上传过程完成后，你就可以在文档中使用这些图片。

* **上传图片到文件夹的快速指南：**

要在编辑器中创建新文件夹，点击文件夹图标，为文件夹设置名称，然后点击创建。现在点击你新建的文件夹，并按照上一段所述流程上传图片，或者将已上传的图片拖放到你的文件夹中。

## 延伸阅读

要了解更多有关 LaTeX 中图片处理的信息，请参见。

* [插入图片](/latex/zh-cn/geng-duo-zhu-ti/27-inserting-images.md)
* [图片和表格的定位](/latex/zh-cn/tu-xing-he-biao-ge/02-positioning-images-and-tables.md)
* [表格和图形列表](/latex/zh-cn/tu-xing-he-biao-ge/03-lists-of-tables-and-figures.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/latex/zh-cn/zhi-shi-ku/088-including-images-on-overleaf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
