# 致命错误：未捕获的 ImagickException：不支持的图像格式 /tmp/phpXXXXXX，位于 /var/www/app/src/Image/Converter.php 第 12 行

- **ID:** `php/imagick-format-not-supported`
- **领域:** php
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

ImageMagick 库无法解码给定文件，因为格式不被识别、文件损坏，或 ImageMagick 安装缺少对所需格式的支持（例如 HEIC、WebP）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| php 8.1 | active | — | — |
| php 8.2 | active | — | — |
| ImageMagick 7.1 | active | — | — |
| Imagick 3.7 | active | — | — |

## 解决方案

1. ```
   Check supported formats with `convert -list format` on the server, then install missing delegates, e.g., `apt-get install libheif-dev` and recompile ImageMagick.
   ```
2. ```
   Convert the file to a supported format before processing using an external tool like `ffmpeg` or `gd` as a fallback.
   ```

## 无效尝试

- **Reinstalling the Imagick PHP extension without updating ImageMagick** — The PHP extension is just a wrapper; the underlying ImageMagick library must be installed with the required delegates (e.g., libheif for HEIC). (85% 失败率)
- **Increasing PHP memory limit** — The error is about format support, not memory; increasing memory will not make ImageMagick recognize an unsupported format. (95% 失败率)
