Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using webp without imageapi_optimize, the default quality is used, and the default is 100. This results in webp images that are larger than the corresponding png or jpeg.
One easy option would be to set the default to the same value as that used by Drupal core for jpeg images.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2916775-10-webp-quality.patch | 525 bytes | JohnAlbin |
Comments
Comment #2
floretan CreditAttribution: floretan at Wunder commentedHere's a patch that does that.
Comment #3
floretan CreditAttribution: floretan at Wunder commentedComment #4
floretan CreditAttribution: floretan at Wunder commentedFixing an obvious logic mistake that slipped in :-)
Comment #5
Bart Vanhoutte CreditAttribution: Bart Vanhoutte at Duo commentedThanks for your patch Florian.
From rigorous testing (a designer and a developer staring at pixels on a screen) we've come to the conclusion that it might be opportune to provide a separate setting for WebP quality instead of using the GD JPEG quality setting.
At the moment we've set WebP quality at 85% and JPEG quality at 80% to achieve similar visual quality and still have a large reduction in file size.
I have been working on a separate setting for WebP and will add this feature to the project soon.
Comment #6
Bart Vanhoutte CreditAttribution: Bart Vanhoutte at Duo commentedComment #7
Bart Vanhoutte CreditAttribution: Bart Vanhoutte at Duo commentedI've added a separate setting for WebP quality.
Florian, would you be so kind to review this?
/admin/config/media/webp/settings
is where it's at.Comment #8
Bart Vanhoutte CreditAttribution: Bart Vanhoutte at Duo commentedComment #9
JohnAlbinThe patch doesn't apply to 8.x-1.x-dev.
Comment #10
JohnAlbinAh, the patch doesn't apply because it's already been committed to the 8.x-1.x branch.
So, I have a couple of changes.
1. Add a link to the configure page from the Drupal modules page.
2. "100" is a horrible default image quality. As stated in the original issue description: "This results in webp images that are larger than the corresponding png or jpeg." Let's change the default to 75 percent to match Drupal's default "jpeg_quality: 75".
Comment #12
alexmoreno CreditAttribution: alexmoreno commented