#60291 closed enhancement (fixed)
Support Lossless WebP in WP_Image_Editor_GD
Reported by: | adamsilverstein | Owned by: | adamsilverstein |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Media | Keywords: | has-patch has-unit-tests commit |
Focuses: | performance | Cc: |
Description
While WordPress has supported WebP lossless since WebP support was introduced in WP 5.8 (https://make.wordpress.org/core/2021/06/07/wordpress-5-8-adds-webp-support/) - outputting lossless sub-size image when you upload a lossless WebP - this only worked correctly when Imagick was installed as at the time lossless was not supported in PHP's bundled GD.
PHP's bundled GD supports lossless output for WebP images since PHP 8.1, see see php.watch/versions/8.1/gd-webp-lossless.
The capability to handle lossless WebPs can be detected in GD by the presence of the IMG_WEBP_LOSSLESS
constant.
To fix this - similar to Imagick, GD should output WebP lossless images when lossless WebP images are uploaded.
Change History (19)
This ticket was mentioned in PR #5891 on WordPress/wordpress-develop by @adamsilverstein.
10 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
9 months ago
- Keywords needs-testing-info needs-unit-tests added
I will work on adding a unit test to the PR next, then it should be ready to commit.
#3
@
9 months ago
Testing Instructions
- test on a server with PHP 8.1 with GD enabled (and no Imagick)
- verify the
IMG_WEBP_LOSSLESS
constant is set - Try uploading a lossless WebP image
- verify that generated images (eg. thumnail, medium, large) are also WebP lossless images
This ticket was mentioned in Slack in #core-performance by adamsilverstein. View the logs.
6 months ago
This ticket was mentioned in PR #1230 on WordPress/wordpress-develop by @adamsilverstein.
6 months ago
#6
@adamsilverstein commented on PR #1230:
6 months ago
#7
closing in favor of https://github.com/WordPress/wordpress-develop/pull/5891
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
5 months ago
This ticket was mentioned in Slack in #core-test by martin.krcho. View the logs.
5 months ago
#10
@
5 months ago
- Keywords has-unit-tests added; needs-unit-tests removed
- Milestone changed from 6.6 to 6.7
- Type changed from defect (bug) to enhancement
We have RC1 later today and...
This ticket needs testing and looks like an enhancement and not a bug fix. So, I am moving it to the next milestone and adjusting its type.
@adamsilverstein it still needs testing instructions. Can you provide them, please? 🙏
#11
@
5 months ago
@oglekler - thanks for triaging I was away and didn’t get a chance to fully test this, but I did leave testing instructions above in comment number 3. I’ll will get this committed in 6.7 - still appreciate any testing/confirmation though!
#12
@
6 weeks ago
@adamsilverstein do you still plan to get this committed for 6.7? There's roughly 24 hours until the beta 1 cut off.
#13
@
6 weeks ago
@adamsilverstein do you still plan to get this committed for 6.7? There's roughly 24 hours until the beta 1 cut off.
Thanks for the ping @desrosj - I'll get this committed today.
@adamsilverstein commented on PR #5891:
6 weeks ago
#18
Merged
GD supports lossless output for WebP images since 8.1, see see https://php.watch/versions/8.1/gd-webp-lossless.
The capability can be detected by the presence of the
IMG_WEBP_LOSSLESS
constant.Similar to Imagick, GD will now output WebP lossless images when lossless WebP images are uploaded.
Also similar to the Imagick implementation, this ignores the quality setting and favors the IMG_WEBP_LOSSLESS constant which must be available.
Trac ticket: https://core.trac.wordpress.org/ticket/60291