php runtime_error ai_generated partial

Fatal error: Uncaught ImagickException: Unsupported image format /tmp/phpXXXXXX in /var/www/app/src/Image/Converter.php:12

ID: php/imagick-format-not-supported

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
1Evidence
2024-03-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
php 8.1 active
php 8.2 active
ImageMagick 7.1 active
Imagick 3.7 active

Root Cause

The ImageMagick library cannot decode the given file because the format is not recognized, the file is corrupt, or the ImageMagick installation lacks support for the required format (e.g., HEIC, WebP).

generic

中文

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

Official Documentation

https://imagemagick.org/script/formats.php

Workarounds

  1. 85% success Check supported formats with `convert -list format` on the server, then install missing delegates, e.g., `apt-get install libheif-dev` and recompile ImageMagick.
    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. 75% success Convert the file to a supported format before processing using an external tool like `ffmpeg` or `gd` as a fallback.
    Convert the file to a supported format before processing using an external tool like `ffmpeg` or `gd` as a fallback.

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. Reinstalling the Imagick PHP extension without updating ImageMagick 85% fail

    The PHP extension is just a wrapper; the underlying ImageMagick library must be installed with the required delegates (e.g., libheif for HEIC).

  2. Increasing PHP memory limit 95% fail

    The error is about format support, not memory; increasing memory will not make ImageMagick recognize an unsupported format.