> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-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{带有图片的项目}
\author{Overleaf}
\date{}

\begin{document}

\maketitle

\section{引言}
\begin{figure}[htp]
    \centering
    \includegraphics[width=4cm]{InsertingImagesEx5}
    \caption{一张星系的图片}
    \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{带有图片的项目}
\author{Overleaf}
\date{}

\graphicspath{{Images/}}

\begin{document}

\maketitle

\section{引言}
\begin{figure}[htp]
    \centering
    \includegraphics[width=4cm]{InsertingImagesEx5}
    \caption{一张星系的图片}
    \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-biao-he-biao-ge/02-positioning-images-and-tables.md)
* [表格与图形列表](/latex/zh-cn/tu-biao-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://overleaf-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.
