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

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

当您使用了 LaTeX 无法识别的图形扩展格式时，就会出现此错误。它也可能在您使用了“错误”的文件路径，导致 LaTeX 感到困惑时出现。

LaTeX 中允许的图像格式取决于您所使用的编译器。如下方左侧菜单所示，这一项会被指定。

![Choosecompiler.PNG](/files/83c8381e176596f0c06fd44c7000eb3751260aff)

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

在使用……编译时 `pdfLaTeX`，您可以从多种图像格式中进行选择。如下所列

* JPG - 这是最常见的基础使用图像格式。它占用空间不大，在大多数情况下用于插入图片都很有用。
* PNG - 这也是一种非常常见的格式。由于它是无损格式，因此更适合需要更高分辨率的图像。图表应以 PNG 格式包含
* EPS - 要在使用……编译时使用 EPS 图像 `pdfLaTeX`，您必须使用 [`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://ayakaleaf-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.
