• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Issue Missing AVIF support in Imagick for PHP 8.5?

Azurel

Silver Pleskian
Server operating system version
AlmaLinux 9.8
Plesk version and microupdate number
18.0.80#6
I’m running AlmaLinux 9.8 with Plesk PHP 8.5 and would like to use Imagick to save images in AVIF format. According to phpinfo():
Imagick module version: 3.8.1
ImageMagick compiled and loaded version: 7.1.2-30 Q16-HDRI
AVIF is missing from the supported formats list.

GD has AVIF support enabled, but my application uses Imagick.
Is there a supported way to add AVIF encoding support to Plesk’s PHP 8.5 Imagick package while retaining Plesk-managed packages and updates?
 
My understanding is there there is no supported way to add AVIF to Imagick without recompiling PHP yourself which means it's self manage at that point. You can always create a helper function to pass any AVIF request off to GD instead if you don't mind rewriting some of the code to allow such functions to work, otherwise you'll need to self manage your own version of PHP with the added support.
 
@Azurel , there doesn't seem to be an existing initiative for adding AVIF support to Imagick for PHP 8.5 provided by Plesk. I will consult with our team if that's something they are considering putting on their agenda.
 
@Azurel , our team confirmed that there are currently no active plans on introducing AVIF support to Imagick and it does classify as a feature request. Could you please submit a new idea on features.plesk.com? Thank you in advance.
 
Hello,

Is this specific to AlmaLinux?

On Ubuntu 26.04.1 LTS, I have Imagick 3.8.1 and ImageMagick 7.1.2-18 Q16 (an older version).
AVIF was already supported for reading, but I had to manually install a plugin to be able to encode AVIF:

apt install libheif-plugin-aomenc

Everything seems to be working now.
 
@Myrlo , it shouldn't be specific to AlmaLinux. It comes down to how ImageMagick is built and which codec libraries it can use at runtime, so it can differ between distributions. As far as I am aware, with Ubuntu's own ImageMagick and libheif packages, AVIF decoding works out of the box, but encoding needs an encoder plugin such as libheif-plugin-aomenc. Installing it enables encoding, which matches what you saw. That's a good tip for anyone on Ubuntu using the distribution's ImageMagick.
 
Hi Azurel, hi Myrlo,

short version: Plesk staff said there are no plans for AVIF in their Imagick package (feature request), so everything below is unsupported/self-managed. But it doesn't have to mean recompiling PHP. Depending on where the ImageMagick library comes from, it may be just a missing coder module.

Background (this is how ImageMagick works, not Plesk-specific): AVIF goes through the "heic" coder, which needs libheif, and libheif needs an AV1 codec for encoding (aom, rav1e or SVT-AV1). That's why on Ubuntu reading worked out of the box and encoding needed the aomenc plugin, as Myrlo found. Azurel's phpinfo shows no AVIF at all, not even for reading, which suggests that on Alma the whole heic coder is missing or not loadable. That's my interpretation, not a confirmed fact.

Step 1 - find out what Plesk's Imagick really uses:
Code:
/opt/plesk/php/8.5/bin/php -r 'print_r(Imagick::getVersion()); print_r(Imagick::queryFormats("*AVIF*")); print_r(Imagick::queryFormats("HEIC"));'
Code:
rpm -qf $(ldd /opt/plesk/php/8.5/lib64/php/modules/imagick.so | awk '/agick/ {print $3; exit}')
rpm -qa | grep -i -E 'magick|heif|avif|libaom|dav1d|rav1e|svt'

Step 2 - check for the coder module and for a policy that blocks it:
Code:
find /usr /opt -name 'heic.*' 2>/dev/null
grep -i -E 'heic|avif|heif' /etc/ImageMagick*/policy.xml

How to read the results:

a) The library comes from a normal repo package (not from /opt/plesk) and there is no heic coder: then a separate coder package may exist for exactly that ImageMagick version. For example Remi splits it out (the cPanel thread shows "ImageMagick6-heic" from Remi, so by that naming there should be an ImageMagick7-heic, please check, I haven't verified it):
Code:
dnf list --enablerepo=remi 'ImageMagick7*'

Please don't enable such a repo permanently on a Plesk server, because it can pull in newer libs than Plesk expects. Use --enablerepo only for that one install and make sure the version matches your library exactly (7.1.2-30), otherwise the module won't load.

b) heic coder is there, but AVIF is still not listed: then libheif has no AV1 codec. Check the output of the rpm -qa line for libheif and libaom (or rav1e / SVT-AV1).

c) The ImageMagick library is shipped by Plesk itself (path under /opt/plesk): then a system-wide coder won't be picked up, and you are at the self-managed options below.

After any change restart the PHP-FPM service of that version and test again with the first command:
Code:
systemctl restart plesk-php85-fpm

If a)-c) don't work out, the options are:
1. Let GD do the AVIF part (it is enabled in your PHP, as Azurel wrote), as scsa20 suggested. Only the AVIF calls need to change.
2. Install a separate ImageMagick 7 with AVIF support (or an AVIF encoder tool) and call it from your application via the command line, if exec() is allowed for your site. This leaves Plesk's PHP packages untouched.
3. A self-built PHP/Imagick, which is self-managed and where you are responsible for updates.

Whatever you choose, please also vote for the feature request on features.plesk.com, as Sebahat asked. And it would be interesting to see the output of the first two commands here, then we know where Plesk's ImageMagick 7.1.2-30 actually comes from.

Regards
Tessa
 
Back
Top