[wp-trac] [WordPress Trac] #57238: Criteria for Responsive Images of WebP: Preserve Alpha + Preserve Lossless + Smaller in size than original

WordPress Trac noreply at wordpress.org
Tue Dec 6 11:18:14 UTC 2022


#57238: Criteria for Responsive Images of WebP: Preserve Alpha + Preserve Lossless
+ Smaller in size than original
-----------------------------+-----------------------------
 Reporter:  abitofmind       |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Media            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------------

Comment (by abitofmind):

 === First an erratum
 - Original file name is `Axure-Prototyping-2-dynamic-title.webp` without
 the `-scaled` suffix!
 - But the image dimension, file size, compression factor were reported
 correctly.
 (Offtopic: Really hate that TRAC does not allow editing an initial issue
 post, makes communication really inefficient)

 == Discussion regarding the criteria, factoring in your answers/infos:

 === 1) Preserve the alpha channel
 - Both lossy and lossless WebP support alpha → Great, no need for
 complicated decision logic here.
 - If both graphic libraries (ImageMagick, GD) are confirmed to support it
 →  We would need no decision logic at all!
   - Sadly GD's [https://www.php.net/manual/en/function.imagesavealpha.php
 imagesavealpha] documentation is not mentioning whether that applies to
 WebP too, only mentions PNG explicitly. I inquired to
 [https://github.com/php/doc-en/issues/2041 please amend the documentation
 in regards of WebP support] and a mention that this would help the
 WordPress team to make decisions, with a backlink to here.
     - Does anyone know from trial'n'error or other sources?

 === 2) Lossless original should result in lossless sized versions → To
 preserve full quality (e.g. screen designs, diagrams, etc)

 - Is it safe to assume that if an original is provided as lossless, that
 this is intentional?
   - I would assume that WebP files which typical consumer software
 produces as output will by default be lossy. And lossless to be a pro
 option only.
   - Or do we need to fear that non tech savvy have unintentional lossless
 WebP files which could greatly benefit from lossy compression at little
 visual degradation?

 - To follow the WordPress philosophy "Options are bad" an Opt-in (as a
 general preference or on a per image basis in the Media Library) for
 preservation of lossless WebP certainly would be acceptable for Pro users,
 if no safe assumptions (see b) can be made that ensure things are going
 alright automatically for the average user.
   - Specifically: My real world example file `Axure-Prototyping-2-dynamic-
 title.webp` showed there are lossless files which can be considered web
 ready, because its creator knew what to do.
   - In these cases (large monochromatic areas, or a lot of void in images
 with alpha) lossless compression can be really "good enough" to be web
 ready. And as it seems even better as the lossy variant, which astonished
 me.
   - Or where the "extra in file size" is worth the guaranteed lossless
 image (logos, diagrams, screen designs or screenshots "which should
 shine") for the author.


 === 3) File size of smaller sized versions should never be larger than the
 original

 - What is the concrete reason here why the lossless original with alpha
 `Axure-Prototyping-2-dynamic-title.webp` is smaller in file size than its
 next 2 smaller sub-sized lossy siblings?

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


More information about the wp-trac mailing list