[wp-trac] [WordPress Trac] #63448: Image quality significantly degrades for resized PNGs with transparency in WordPress 6.8.1

WordPress Trac noreply at wordpress.org
Mon May 26 16:43:05 UTC 2025


#63448: Image quality significantly degrades for resized PNGs with transparency in
WordPress 6.8.1
-------------------------------------------------+-------------------------
 Reporter:  elvismdev                            |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.8.2
Component:  Media                                |     Version:  6.8
 Severity:  critical                             |  Resolution:
 Keywords:  has-patch has-test-info dev-         |     Focuses:
  feedback has-unit-tests commit fixed-major     |
-------------------------------------------------+-------------------------

Comment (by siliconforks):

 Replying to [comment:70 SirLouen]:
 > (Not sure what's going on with the width)

 The width and height are just hard-coded in the test script - so if you
 don't change those, some images might get stretched (but I don't think
 that really matters for our purposes).

 Did you run the test script with or without this line commented out?

 {{{#!php
 //      $image->setOption( 'png:format', 'png8' );
 }}}

 My point with the `oval-or8-grayscale-indexed.png` image is that may work
 differently depending on whether you have that line of code or not.

 > Also for the rabbit example these are my results:
 >
 > {{{
 > Initial file info:
 > Size of rabbit-time-paletted-or8.png is 200581 bytes
 > Pixel depth of rabbit-time-paletted-or8.png is 8
 > Color type of rabbit-time-paletted-or8.png is 3
 >
 > Final file info:
 > Size of rabbit-time-paletted-or8.png-mod.png is 213153 bytes
 > Pixel depth of rabbit-time-paletted-or8.png-mod.png is 8
 > Color type of rabbit-time-paletted-or8.png-mod.png is 6
 > }}}

 That's odd ... that's not what I'm getting:

 {{{
 size of rabbit-time-paletted-or8.png is 200581
 pixel depth of rabbit-time-paletted-or8.png is 8
 color type of rabbit-time-paletted-or8.png is 3
 size of rabbit-time-paletted-or8.png-mod.png is 68109
 pixel depth of rabbit-time-paletted-or8.png-mod.png is 8
 color type of rabbit-time-paletted-or8.png-mod.png is 3
 }}}

 I wonder if there may be some differences in the way different ImageMagick
 versions are handling this...

 I still think that using `quantizeImage` is probably the best way to go
 here.  Even if there are some versions of ImageMagick which fail to save
 the image as indexed, using `quantizeImage` will still probably help to
 keep the file size from blowing up too much (though it still won't be as
 small as it would be if it had used indexed format).

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


More information about the wp-trac mailing list