[wp-trac] [WordPress Trac] #35725: Add WebP support.

WordPress Trac noreply at wordpress.org
Thu Mar 18 15:05:26 UTC 2021


#35725: Add WebP support.
-------------------------------------------------+-------------------------
 Reporter:  markoheijnen                         |       Owner:
                                                 |  adamsilverstein
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.8
Component:  Media                                |     Version:  3.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-unit-    |     Focuses:
  tests needs-dev-note dev-feedback              |
-------------------------------------------------+-------------------------

Comment (by adamsilverstein):

 Thanks for the feedback @mikeschroder - replies inline:

 >It looks like this, right now, does not fall back to JPEG resizing on
 servers where WebP is not supported. Is that accurate? If so, I think it
 should do this before it lands.

 It should for sure, that is the intended behavior. I may have the logic
 wrong now and haven't carefully tested this. I've been doing all my
 testing with PHP v8 so far, and need to test with earlier versions,
 imagick & gd, with and without webp support to validate the correct
 behavior. As you stated, in any case where the platform does not support
 WebP behavior should be unchanged (the original format should be used).


 > What do the DSSIM differences look like between the existing JPEG
 resizing, both with Imagick and GD?

 Great question. I don't know enough about the format to answer that
 question, I did find this article:
 https://developers.google.com/speed/webp/docs/webp_study and @marylauc may
 be able to add some details.

 Would you expect much difference between Imagick and GD, wouldn't they
 both rely on the same underlying code?

 > I'm interested in making sure quality doesn't suffer compared to
 existing methods.

 Absolutely, this is critical! I think WebP quality is well established,
 let's validate that.


 > Are color profiles respected with this method? I.e. Will users end up
 with the same colors with the original JPEG as with the other sizes?

 There is a fundamental difference here you rightly flag - "Webp only
 supports 4:2:0 chroma subsampling.". This was discussed a bit above
 https://core.trac.wordpress.org/ticket/35725#comment:82 and I tend to
 agree this should not affect the vast majority of use cases. The existing
 filter could be used to fine tune the behavior, for example opting out for
 certain image types.


 > What does the resource use look like when profiled compared with
 existing resizing methods for images of the same dimensions? (this is re:
 your question -- I think host response depends on what the difference is)

 In my initial testing with twentytwenty which has nine total image sizes,
 switching to WebP reduced my files sizes by ~25%.


 > I saw you mention that Responsive Images support doesn't work right now
 -- agreed that is important to have working as well.

 Right, this is working as expected now. Here is what it looks like when I
 upload and insert a WebP or a jpeg image:


 {{{
 <img loading="lazy" width="1024" height="683"
 src="https://wpdev.localhost/wp-content/uploads/2021/03/testimage-
 1024x683.webp" alt=""
 class="wp-image-2081"
 srcset="https://wpdev.localhost/wp-content/uploads/2021/03/testimage-
 1024x683.webp 1024w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-300x200.webp
 300w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-768x512.webp
 768w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-
 1536x1024.webp 1536w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-
 2048x1365.webp 2048w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-1200x800.webp
 1200w,
 https://wpdev.localhost/wp-content/uploads/2021/03/testimage-
 1980x1320.webp 1980w"
 sizes="(max-width: 1024px) 100vw, 1024px">
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/35725#comment:107>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list