Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Paletter image not supported by webp #1561

Open
chimok opened this issue Sep 24, 2024 · 11 comments
Open

Fatal error: Paletter image not supported by webp #1561

chimok opened this issue Sep 24, 2024 · 11 comments
Labels
[Type] Bug An existing feature is broken

Comments

@chimok
Copy link

chimok commented Sep 24, 2024

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

@chimok chimok added the [Type] Bug An existing feature is broken label Sep 24, 2024
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Sep 24, 2024
@adamsilverstein
Copy link
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?

@chimok
Copy link
Author

chimok commented Sep 25, 2024

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

@chimok
Copy link
Author

chimok commented Sep 27, 2024

@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).

@IlyaZha
Copy link

IlyaZha commented Oct 21, 2024

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

@mytory
Copy link

mytory commented Nov 9, 2024

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

@adamsilverstein
Copy link
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

@adamsilverstein
Copy link
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?

@chimok
Copy link
Author

chimok commented Jan 8, 2025

@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"
}

@adamsilverstein
Copy link
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?

@chimok
Copy link
Author

chimok commented Jan 24, 2025

@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.

@adamsilverstein
Copy link
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature is broken
Projects
Status: Not Started/Backlog 📆
Development

No branches or pull requests

4 participants