php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.42k stars 530 forks source link

Add support for webp_lossless to GD and GMagick #858

Closed ausi closed 6 months ago

ausi commented 6 months ago

Fixes #857

The IMagick driver already supports the webp_lossless option, see https://github.com/php-imagine/Imagine/blob/922e0327a6b36d1da0acca69993ac85395adcea6/src/Imagick/Image.php#L829-L831

This pull request adds support for GD and GMagick too.

jcogs-design commented 6 months ago

Actually this doesn't fix #857. Not sure why anyone would think it does. It fixes a related problem in a different library, but to suggest this is a fix for #857 is just wrong.

ausi commented 6 months ago

It fixes a related problem in a different library, but to suggest this is a fix for #857 is just wrong.

I don’t understand. In #857 you wrote about “The saveOrOutput method in the GD\Image.php class has an explicit check (line 734)”. And this pull request fixes exactly that as it adds support for the webp_lossless option on line 733.

What do you mean by “different library”? This pull request adds support for webp_lossless to GMagick and the GD library.

Did you test these changes? The following code worked fine in my test:

$image = (new \Imagine\Gd\Imagine)->open('image.png');
$image->save('image.webp', ['webp_lossless' => true]);

If it doesn’t work for you, please provide the steps to reproduce the issue.