Skip to content

Fatal error: Paletter image not supported by webp #1561

Closed

Description

@chimok

Bug Description

I just tried to convert a existing site to webp with performance lab + modern image.

Steps to reproduce

  1. Install and enable both plugins
  2. Change setting to "webp"
  3. Use wp-cli to regenerate all images: wp media regenerate
  4. After a few images it stops with the error

Fatal error: Paletter image not supported by webp in /usr/www/users/xxxxxx/staging-xxxxxx-com/releases/20240924131521/wp-includes/class-wp-image-editor.php on line 592

Screenshots

image

Additional Context

  • PHP Version: 8.1
  • OS: Linux
  • Browser: chromium
  • Plugin Version: 3.4.1 / 2.2.0
  • Device: Desktop

It seems the fix is to convert the image to RGB if it isn't already: https://stackoverflow.com/questions/39292617/fatal-error-paletter-image-not-supported-by-webp

Activity

  1. added
    [Type] Bug
    on Sep 24, 2024
  2. moved this to Not Started/Backlog 📆 in WP Performance Ongoingon Sep 24, 2024
  3. adamsilverstein commented on Sep 24, 2024

    @adamsilverstein
    Member

    Hey @chimok - thanks for the bug report and the link to a potential solution.

    If you identified the image that the error is thrown on, can you upload it here as a testing artifact?

  4. chimok commented on Sep 25, 2024

    @chimok
    Author

    Hi @adamsilverstein, the image is from my customer. I'm not sure have the permission to share it here.

    When I open the image with gimp I get this message, maybe that helps? It seems to be sRGB IEC61966-2.1
    Anyway, I miss exception handling in your plugin. No matter what error it is, it should simply skip image instead exit the script.
    image

  5. chimok commented on Sep 27, 2024

    @chimok
    Author

    @adamsilverstein Today I've got the idea to enable image magick on the server and try it again. I can confirm with image magick been able to convert almost all images. So this happens only with GD. If image magick is enabled, wordpress switch to it automatically. Anyway, with AVIF the script simply returned "Killed", I think that is because of old version of image magick.

    Only regenerated 428 of 442 images (5 failed, 9 skipped).
    
  6. IlyaZha commented on Oct 21, 2024

    @IlyaZha

    I have same errors with disabled image magick.
    @adamsilverstein Image example: Image

  7. mytory commented on Nov 9, 2024

    @mytory

    The same error occurs with PNG files processed through https://tinypng.com/

  8. adamsilverstein commented on Dec 17, 2024

    @adamsilverstein
    Member

    So this happens only with GD

    @chimok - I'm curious how you got a build running with GD supporting AVIF, can you share some details about your stack? My testing has all been with Imagick because I haven't gotten a local GD with AVIF support running

  9. adamsilverstein commented on Dec 17, 2024

    @adamsilverstein
    Member

    I have same errors with disabled image magick.
    @adamsilverstein Image example:

    Hey @IlyaZha thanks for sharing a sample image!

    Unfortunately it looks like GitHub converts uploaded images - when I downloaded it I got a PNG. Can you try putting it in a zip and re-attaching, or link to an image on the web?

  10. chimok commented on Jan 8, 2025

    @chimok
    Author

    @adamsilverstein It's the version that was installed on hetzner server (https://www.hetzner.com/).
    Afaik avif support ist official supported since PHP 8.1? https://www.php.net/manual/en/function.imagecreatefromavif.php

    I just test it on my local installation, I'm using ddev for development. https://ddev.com/

    <?php
    
    function get_gd_supported_formats(): array
    {
        $ret = [];
        foreach (gd_info() as $name => $supported) {
            if (! $supported) {
                continue;
            }
            $supportEndNeedle = " Support";
            $supportEndPos = strrpos($name, $supportEndNeedle);
            if (false === $supportEndPos || strlen($name) !== ($supportEndPos + strlen($supportEndNeedle))) {
                continue;
            }
            $name = substr($name, 0, $supportEndPos);
            $ret[] = $name;
        }
        return $ret;
    }
    
    $test = get_gd_supported_formats();
    
    var_dump($test);

    The output

    array(12) {
      [0]=>
      string(8) "FreeType"
      [1]=>
      string(8) "GIF Read"
      [2]=>
      string(10) "GIF Create"
      [3]=>
      string(4) "JPEG"
      [4]=>
      string(3) "PNG"
      [5]=>
      string(4) "WBMP"
      [6]=>
      string(3) "XPM"
      [7]=>
      string(3) "XBM"
      [8]=>
      string(4) "WebP"
      [9]=>
      string(3) "BMP"
      [10]=>
      string(4) "AVIF"
      [11]=>
      string(8) "TGA Read"
    }
    
  11. adamsilverstein commented on Jan 8, 2025

    @adamsilverstein
    Member

    Afaik avif support ist official supported since PHP 8.1? https://www.php.net/manual/en/function.imagecreatefromavif.php

    PHP can be compiled to include AVIF support, but this is not on by default - see https://php.watch/versions/8.1/gd-avif. In my experience, not many hosts or local hosting tools support AVIF in their GD stack, even when running php 8.1 or greater.

    I just test it on my local installation, I'm using ddev for development. https://ddev.com/
    Interesting. I can't use Docker or ddev, but good to hear you have a local environment for testing.

    It's the version that was installed on hetzner server (https://www.hetzner.com/).

    Do you know what distribution you are running there?

  12. chimok commented on Jan 24, 2025

    @chimok
    Author

    @adamsilverstein I'm running SuSE Tumbleweed. But DDEV is a docker based setup, so I don't think it really does matter? You install docker and the ddev cli, then following the guide here: https://roots.io/bedrock/docs/bedrock-with-ddev/ and you should have exactly the same setup I'm using.

  13. adamsilverstein commented on Jan 30, 2025

    @adamsilverstein
    Member

    @adamsilverstein I'm running SuSE Tumbleweed. But DDEV is a docker based setup, so I don't think it really does matter? You install docker and the ddev cli, then following the guide here: https://roots.io/bedrock/docs/bedrock-with-ddev/ and you should have exactly the same setup I'm using.

    Thanks for the details @chimok - I'll give that a try!

  14. adamsilverstein commented on Jul 19, 2025

    @adamsilverstein
    Member

    @chimok - can you check if the patch in #2024 fixes your issue?

  15. westonruter commented on Aug 15, 2025

    @westonruter
    Member

    @chimok I prepared a ZIP build of the plugin you can use to install via WP Admin > Plugins > Add Plugins > Upload Plugin.

  16. moved this from Not Started/Backlog 📆 to Done 😃 in WP Performance Ongoingon Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] Bug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions