> 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/latex-cuo-wu/21-latex-error-unknown-graphics-extension-.xxx.md).

# LaTeX 错误：未知的图形扩展名：.XXX

当你使用了 LaTeX 无法识别的图形扩展时，就会出现此错误。当你使用了一个“有问题”的文件路径，导致 LaTeX 感到困惑时，也可能会出现此错误。

LaTeX 中允许的图像格式取决于你所使用的编译器选择。如下所示，这在左侧菜单中指定。

![选择编译器.PNG](/files/83c8381e176596f0c06fd44c7000eb3751260aff)

**使用……编译 `pdfLaTeX`:**

当使用 `pdfLaTeX`编译时，你可以选择的图像格式非常多。如下所列

* JPG - 这是最常见的基本图像格式。它占用空间不大，在大多数情况下用于插入图片都很有用。
* PNG - 这也是另一种非常常见的格式。由于它是无损格式，因此更适合需要更高分辨率的图像。图表应以 PNG 格式插入
* EPS - 要在使用 `pdfLaTeX`编译时使用 EPS 图像，你必须使用 [`epstopdf` 宏包](https://www.google.ie/#q=ctan+etstopdf).
* PDF - 这对于在你的 LaTeX 项目中包含文档很有用。它支持矢量图像，就像 EPS 一样，因此当你希望在海报等大型文档中使用高分辨率图像时，它非常有用。

**使用 LaTeX 编译：**

当使用 LaTeX 编译时，你唯一可以使用的图像格式是 *封装式 PostScript* 或 *EPS*。EPS 文件是基于矢量的，这意味着图像在缩放时不会变化，因此如果你想创建海报等大型文档并保持高质量图像，它很有用。EPS 文件会自然声明图像大小，因此 LaTeX 更容易以美观的方式组织文本和图形。

## 常见原因

**使用不受支持的图像格式：**

此错误最常见的原因是使用了某个编译器不支持的图像格式，例如 **`.gif`** 或 **`.ps`** 。最好的解决方法是在可能的情况下将其转换为受支持的格式。

**使用不正确的文件名：**

每当 LaTeX 看到一个句点时，它都会将其后面的内容解释为文件扩展名。因此，如果文件名中有句点，例如 `image.logo.jpg`，LaTeX 就会感到困惑，因为它会认为文件扩展名是 `.logo.jpg`。因此，你必须始终给图片命名，确保标题中没有句点。


---

# 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/latex-cuo-wu/21-latex-error-unknown-graphics-extension-.xxx.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.
