[wp-trac] [WordPress Trac] #63773: Palette-based PNG cause failure attempting AVIF/WebP conversion under GD

WordPress Trac noreply at wordpress.org
Thu Jul 31 17:39:26 UTC 2025


#63773: Palette-based PNG cause failure attempting AVIF/WebP conversion under GD
-------------------------------------------------+-------------------------
 Reporter:  adamsilverstein                      |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Media                                |     Version:  5.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  reviewed needs-testing                         |
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests dev-
     reviewed needs-testing


Comment:

 Pushed the fix in https://github.com/WordPress/wordpress-
 develop/pull/9368/commits/73b5cb2a1a37e1d275668011fdd06a903d0f75c5, tests
 should now pass.

 This is ready for review and testing.

 == Test instructions
 1. Add a filter to WordPress as an mu plugin:


 {{{
 // Convert PNG's uploads to WebP.
 add_filter( 'image_editor_output_format', function( $format ) {
         return array(
                 'image/png' => 'image/webp'
         );
 } );
 }}}

 2. Upload the sample dice image from the PR (or any palette based PNG
 image) to the media library.
 3. Check the generated files and PHP logs.

 === Expected
 All files are generated as WebPs.
 No errors in logs.

 === Actual (before fix)
 Fill sized image is generated with zero file size and is not a valid
 image.
 PHP error or warning in log.

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


More information about the wp-trac mailing list