[wp-trac] [WordPress Trac] #48215: PNG quality not handled with GD

WordPress Trac noreply at wordpress.org
Fri Oct 4 14:03:43 UTC 2019


#48215: PNG quality not handled with GD
-------------------------+-----------------------------
 Reporter:  Iulia Cazan  |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The quality of the PNG images is not handled correctly with GD (in fact at
 all). To make this work it would be required two small changes:

 1. wp-includes/class-wp-image-editor-gd.php @ line 433 - pass the quality
 argument for the function used to make the image
 {{{#!php
 <?php
 if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename,
 $this->get_quality() ) ) ) {
         return new WP_Error( 'image_save_error', __( 'Image Editor Save
 Failed' ) );
 }
 }}}


 2. wp-includes/class-wp-image-editor.php @ line 261 - append the quality
 verification in case the image is PNG (the quality range is 1 -> 9, not 1
 -> 100 like for JPEG )
 {{{#!php
 <?php
 if ( 'image/png' == $this->mime_type ) {
         if ( $quality > 9 ) {
                 $quality = ceil( $quality / 10 );
                 $quality = ( 10 >= $quality ) ? 9 : $quality;
         }
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48215>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list