The WordPress Docker images cannot encode AVIF images using ImageMagick/Imagick, despite having AVIF decoding support. This occurs because the libheif-plugin-aomenc package (the AVIF encoder) is removed when recommended packages are stripped from the image.
When attempting to convert images to AVIF format using Imagick, the following error occurs:
no encode delegate for this image format `AVIF' @ error/constitute.c/WriteImage/1412
The queryFormats check passes for "AVIF" because the decoder is present, but encoding fails.
The issue seems to stem from the Dockerfile template's package installation process:
-
libmagickwand-dev is installed at:
-
Recommended packages are removed at:
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ |
Dependency chain:
Here, libheif-plugin-dav1d is the decoder and is a hard dependency and libheif-plugin-aomdec is a encoder but it is a recommended dependency (ref: https://packages.debian.org/trixie/libheif1). It is not included in the WordPress Docker image because recommended packages are removed, causing the loss of encoder.
The WordPress Docker images cannot encode AVIF images using ImageMagick/Imagick, despite having AVIF decoding support. This occurs because the
libheif-plugin-aomencpackage (the AVIF encoder) is removed when recommended packages are stripped from the image.When attempting to convert images to AVIF format using Imagick, the following error occurs:
The
queryFormatscheck passes for"AVIF"because the decoder is present, but encoding fails.The issue seems to stem from the Dockerfile template's package installation process:
libmagickwand-devis installed at:wordpress/Dockerfile.template
Line 66 in 4eb711d
Recommended packages are removed at:
wordpress/Dockerfile.template
Line 124 in 4eb711d
Dependency chain:
libmagickwand-devdepends onlibmagickcore-7.q16-dev(ref: https://packages.debian.org/trixie/libmagickwand-7.q16-dev)
libmagickcore-7.q16-devdepends onlibmagickcore-7.q16-10(ref: https://packages.debian.org/trixie/libmagickcore-7.q16-dev)
libmagickcore-7.q16-10depends onlibheif1(ref: https://packages.debian.org/trixie/libmagickcore-7.q16-10)
libheif1depends onlibheif-plugin-dav1dorlibheif-plugin-aomdec(ref: https://packages.debian.org/trixie/libheif1)
Here,
libheif-plugin-dav1dis the decoder and is a hard dependency andlibheif-plugin-aomdecis a encoder but it is a recommended dependency (ref: https://packages.debian.org/trixie/libheif1). It is not included in the WordPress Docker image because recommended packages are removed, causing the loss of encoder.