From e3d34bb72321434dc7126ed97924fa119ff523d8 Mon Sep 17 00:00:00 2001 From: jan-tricks <113358501+jan-tricks@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:20:47 +0100 Subject: [PATCH 1/2] WebP Quality Option --- src/OptimizerChainFactory.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OptimizerChainFactory.php b/src/OptimizerChainFactory.php index 634bad6..541a2d7 100644 --- a/src/OptimizerChainFactory.php +++ b/src/OptimizerChainFactory.php @@ -15,9 +15,11 @@ public static function create(array $config = []): OptimizerChain { $jpegQuality = '--max=85'; $pngQuality = '--quality=85'; + $webpQuality = '-q 80'; if (isset($config['quality'])) { $jpegQuality = '--max='.$config['quality']; $pngQuality = '--quality='.$config['quality']; + $webpQuality = '-q 80'.$config['quality']; } return (new OptimizerChain()) @@ -48,10 +50,10 @@ public static function create(array $config = []): OptimizerChain '-O3', ])) ->addOptimizer(new Cwebp([ + $webpQuality, '-m 6', '-pass 10', '-mt', - '-q 80', ])); } } From 531f95e876f69b1aba28c11124cd41f5491df824 Mon Sep 17 00:00:00 2001 From: jan-tricks <113358501+jan-tricks@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:48:01 +0100 Subject: [PATCH 2/2] Update src/OptimizerChainFactory.php Co-authored-by: Michal Kleiner --- src/OptimizerChainFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OptimizerChainFactory.php b/src/OptimizerChainFactory.php index 541a2d7..20d6da0 100644 --- a/src/OptimizerChainFactory.php +++ b/src/OptimizerChainFactory.php @@ -19,7 +19,7 @@ public static function create(array $config = []): OptimizerChain if (isset($config['quality'])) { $jpegQuality = '--max='.$config['quality']; $pngQuality = '--quality='.$config['quality']; - $webpQuality = '-q 80'.$config['quality']; + $webpQuality = '-q '.$config['quality']; } return (new OptimizerChain())