Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Find Unused ImagesNew to Visual Studio Code? Get it now.
Find Unused Images

Find Unused Images

find-unused-images

|
1 install
| (0) | Free
查找项目中未使用的图片资源
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Find Unused Images (查找未使用图片)

English | 中文


English

Find Unused Images is a lightweight VS Code extension designed to help developers clean up their projects by identifying image files that are no longer referenced in the codebase.

✨ Features

  • Custom Scope: Specify the directory to scan for images and the directory to search for references (e.g., scan images in src/assets but search for usages in src/).
  • Flexible Scanning: Supports common image formats (.png, .jpg, .jpeg, .gif, .svg, .webp, .ico, .bmp) and ignores standard build folders (node_modules, dist, etc.).
  • Visual Report: Generates a Markdown report listing all unused images with clickable links for quick verification.

🚀 Usage

  1. Open your project in VS Code.
  2. Open the Command Palette (Cmd+Shift+P on macOS / Ctrl+Shift+P on Windows).
  3. Type and select "Find Unused Images".
  4. Follow the prompts:
    • Image Directory: Enter the relative path of your image folder (e.g., src/assets). Leave empty to scan the entire project.
    • Search Directory: Enter the relative path where your code lives (e.g., src). Leave empty to search the entire project.
  5. Wait for the scan to complete. A report file will open automatically.

⚠️ Note

  • This plugin uses static string matching (checks if the image filename exists in code files).
  • Dynamic references (e.g., imgSrc = 'icon-' + index + '.png') cannot be detected and may be falsely reported as unused. Please verify before deleting files.

中文

Find Unused Images 是一个轻量级的 VS Code 插件,旨在帮助开发者查找项目中不再使用的图片文件,以此来清理冗余资源并减小项目体积。

✨ 功能特性

  • 自定义范围:支持分别指定“图片资源目录”和“代码查找目录”(例如:仅扫描 src/assets 下的图片,但在 src/ 目录下查找引用)。
  • 灵活扫描:支持常见的图片格式 (.png, .jpg, .jpeg, .gif, .svg, .webp, .ico, .bmp),自动忽略无关目录 (node_modules, dist 等)。
  • 可视化报告:扫描结束后自动生成一份 Markdown 格式的报告,列出所有未使用的图片,并附带可点击的文件链接,方便快速确认。

🚀 使用方法

  1. 在 VS Code 中打开您的项目。
  2. 打开命令面板 (macOS 按 Cmd+Shift+P / Windows 按 Ctrl+Shift+P)。
  3. 输入并选择 "查找未使用的图片 (Find Unused Images)"。
  4. 根据提示输入:
    • 图片资源目录:输入存放图片的相对路径(例如 src/assets)。留空则扫描整个项目。
    • 代码查找目录:输入代码所在的相对路径(例如 src)。留空则在整个项目中查找。
  5. 等待扫描完成,结果页面会自动打开。

⚠️ 注意事项

  • 本插件采用静态字符串匹配的方式(即检查代码文件中是否包含图片的文件名)。
  • 动态引用的图片(例如代码写为 imgSrc = 'icon-' + index + '.png')无法被静态识别,可能会被误报为“未使用”。在删除文件前,请务必进行人工确认。
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft