Open theamnesic opened 3 years ago
The difference of the size is very important, 66ko (Timber) versus 232ko (ImageMagick).
There is lossless
parameter in the ImageMagick documentation, maybe PHP ignore this?
Ok, it's a new feature:
In PHP 8.1, the GD extension supports lossless encoding, and declares a new PHP constant IMG_WEBP_LOSSLESS which can be passed to imagewebp function to enable lossless encoding of a GdImage object.
TimberImage(my_image).src('full')|towebp(101)
in the future?
Expected behavior
Timber WebP lossless quality is lossless quality.
Actual behavior
Seems like the
towebp
filter with quality 100 don't make lossless quality, compared to ImageMagick command. When I use Timber with an original image at 381ko, Timber generate a 66ko image, ImageMagick a 232ko image.Original: https://www.dropbox.com/s/7evk7rrfqsbj6x9/original.png?dl=0 Timber WebP: https://www.dropbox.com/s/oj8gdqf6qnaqtjs/timber.webp?dl=0 ImageMagick WebP: https://www.dropbox.com/s/cgfgklf013xttg4/imagemagick.webp?dl=0
(Sorry for using Dropbox, Github doesn't support WebP upload)
Steps to reproduce behavior
Generate a WebP with Timber:
TimberImage(my_image).src('full')|towebp(100)
Generate a WebP with ImageMagick:
magick original.png -quality 100 generated.webp
The image is lossless with ImageMagick, not with Timber.
What version of WordPress, PHP and Timber are you using?
PHP 7.4 with Mamp Pro, Timber 1.19.1, WP 5.8.2.
Thanks!