mirror of
https://github.com/Intervention/image.git
synced 2025-08-19 04:01:30 +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
|
||||
{
|
||||
$data = $this->getBuffered(function () use ($image) {
|
||||
imagewebp($image->core()->native(), null, $this->quality);
|
||||
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
|
||||
$data = $this->getBuffered(function () use ($image, $quality) {
|
||||
imagewebp($image->core()->native(), null, $quality);
|
||||
});
|
||||
|
||||
return new EncodedImage($data, 'image/webp');
|
||||
|
Reference in New Issue
Block a user