# 镜像

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com.cn/help/idea/llms.txt).

IntelliJ IDEA 提供多种查看图像的方式。 您可以使用 [定位到源代码](#internal)或 [在外部图像编辑器中打开图像](#ext)。

## 支持的图像格式

IntelliJ IDEA 开箱即用地支持所有常见的图像格式，如 PNG、SVG、JPG 和 GIF。

> **Note:**
> * 要打开 [WebP](https://developers.google.com/speed/webp) 格式的图像，请确保已按照 [插件](managing-plugins.html) 中的说明，在 设置 | 插件 页面中启用捆绑的 WebP 格式图片文件。 插件。
>
> * [AVIF](https://web.dev/learn/images/avif) 格式目前暂不支持。

Procedure: 查找所有支持的图像文件类型列表

1. 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) 打开   设置  ，并转到  `编辑器 | 文件类型` 。

2. 在   识别的文件类型   列表中，找到   图像   项。   文件名模式   区域显示可从 IntelliJ IDEA 打开的已识别图像文件扩展程序的完整、版本准确的设置。

![支持的图像文件类型完整列表](https://resources.jetbrains.com.cn/help/img/idea/2026.3/supported_image_formats_steps.png)

详细了解 IntelliJ IDEA 支持的文件类型，请访问 [文件类型关联](creating-and-registering-file-types.html)。

## 查看图像

Procedure: 在 IntelliJ IDEA 中查看图像

* 在   项目   工具窗口中，找到并选择图像文件。

或者，将文本光标置于编辑器中引用图像的地方，然后按 `Ctrl+B` (Windows), `⌘ B` (macOS), `⌘ B` (IntelliJ IDEA Classic (macOS)), `⌘ B` (macOS System Shortcuts), `Ctrl+B` (XWin), `Ctrl+B` (GNOME), `Ctrl+B` (KDE), `Ctrl+Alt+G` (Emacs), `F12` (Sublime Text), `F12` (Sublime Text (macOS)), `F12` (Visual Studio), `F12` (Visual Studio (macOS)), `Ctrl+B` (NetBeans), `F3` (Eclipse), `F3` (Eclipse (macOS))。

* 要在弹出窗口中预览图像而不是在单独的选项卡中，请选择其引用并按 `Ctrl+Shift+I` (Windows), `⌥ Space` (macOS), `⌘ ⇧ I` (IntelliJ IDEA Classic (macOS)), `⌘ Y` (macOS System Shortcuts), `Ctrl+Shift+I` (XWin), `Ctrl+Shift+I` (GNOME), `Ctrl+Shift+I` (KDE), `Ctrl+Shift+I` (Emacs), `Ctrl+Shift+I` (Sublime Text), `⌥ Space` (Sublime Text (macOS)), `Alt+F12` (Visual Studio), `⌥ Space` (Visual Studio (macOS)), `Ctrl+Shift+I` (NetBeans), `Ctrl+Shift+I` (Eclipse), `⌥ Space` (Eclipse (macOS))。

Procedure: 在外部编辑器中查看图像

* 在   项目   工具窗口中，右键点击图像文件并选择  `跳转到外部编辑器` 。

或者按 `Ctrl+Alt+F4` (Windows), `⌘ ⌥ F4` (macOS), `⌘ ⌥ F4` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ F4` (macOS System Shortcuts), `Ctrl+Alt+4` (XWin), `Ctrl+Alt+4` (GNOME), `Ctrl+Alt+4` (KDE), `Ctrl+Alt+F4` (Emacs), `Ctrl+Alt+F4` (Sublime Text), `⌘ ⌥ F4` (Sublime Text (macOS)), `Ctrl+Alt+F4` (Visual Studio), `⌘ ⌥ F4` (Visual Studio (macOS)), `Ctrl+Alt+F4` (NetBeans), `Ctrl+Alt+F4` (Eclipse), `⌘ ⌥ F4` (Eclipse (macOS))。

IntelliJ IDEA 会在操作系统默认使用的编辑器中打开该图像。 您可以在 IDE 中 [配置另一个图像编辑器](#change-external-editor) 以打开文件。

Procedure: 更改默认外部编辑器

1. 在编辑器中右键点击图像，然后从上下文菜单中选择   编辑外部编辑器的路径…  。

您也可以按 `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) 并输入  `编辑外部编辑器路径` 。

2. 在   外部编辑器路径  对话框中，指定您想要打开图像的应用程序的路径，然后点击   保存  。

![指定外部编辑器的路径](https://resources.jetbrains.com.cn/help/img/idea/2026.3/change-external-image-editor.png)

## 导入图像

Procedure: 示例：导入图像

图片属于 [resource files](resource-files.html)。 它们应存储在一个专用文件夹—— [Resources Root](content-roots.html#folder-categories)。 如果您的项目中没有这个文件夹， [创建一个新目录](add-items-to-project.html#new-directory)，在   项目   工具窗口中右键点击它，然后选择  `将目录标记为 | 资源根目录` 。

1. 在文件管理器中复制该文件，然后将其粘贴到 IntelliJ IDEA   项目   工具窗口中包含资源文件的文件夹中。

2. 在打开的对话框中，如果需要，请编辑文件名和目标位置。 点击   OK  。

![导入图像](https://resources.jetbrains.com.cn/help/img/idea/2026.3/image_in_resources_folder.png)

3. 右键点击   项目   工具窗口中粘贴的图像，然后选择  `复制 | 来自源根的路径` 。

4. 在您想要使用图像的类中，将文本光标放在所需的行上，然后按 `Ctrl+V` (Windows), `⌘ V` (macOS), `⌘ V` (IntelliJ IDEA Classic (macOS)), `⌘ V` (macOS System Shortcuts), `Ctrl+V` (XWin), `Ctrl+V` (GNOME), `Ctrl+V` (KDE), `Shift+Insert` (Emacs), `Ctrl+Shift+V` (Sublime Text), `⌘ ⇧ V` (Sublime Text (macOS)), `Ctrl+V` (Visual Studio), `⌘ V` (Visual Studio (macOS)), `Ctrl+V` (NetBeans), `Ctrl+V` (Eclipse), `⌘ V` (Eclipse (macOS)) 以粘贴图像路径。

运行应用程序或其片段，以确保图像已正确插入。

## See also

### 相关

[HTML](editing-html-files.html) [资源文件](resource-files.html)

