mirror of
https://github.com/Intervention/image.git
synced 2025-08-19 12:11:26 +02:00
Set lossless quality for GD WebpEncoder
A value of 101 is actually specified for lossless coding with GD. However, since Imagick expects 100 for lossless in WebP format, I adjust this for both drivers.
This commit is contained in:
@@ -13,8 +13,9 @@ class WebpEncoder extends DriverSpecializedEncoder
|
|||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$data = $this->getBuffered(function () use ($image) {
|
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
|
||||||
imagewebp($image->core()->native(), null, $this->quality);
|
$data = $this->getBuffered(function () use ($image, $quality) {
|
||||||
|
imagewebp($image->core()->native(), null, $quality);
|
||||||
});
|
});
|
||||||
|
|
||||||
return new EncodedImage($data, 'image/webp');
|
return new EncodedImage($data, 'image/webp');
|
||||||
|
Reference in New Issue
Block a user