[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
Wed May 28 16:55:52 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 nosilver4u):

 As @siliconforks said, an indexed PNG won't contain more than 256 colors.
 Thus, it should be acceptable running `getImageColors`, so long as you do
 it **prior** to resizing and **only** for indexed PNG images.

 That said, the differences in file size are not very large if you just use
 256 as the max. The only one that gets way out of line is test8.png, but
 that's mostly due to the conversion to grayscale+alpha. It does get
 significantly worse (117 kb vs. 175 kb) when you let it use 256 colors
 instead of 9, so that may be worth considering.

 That is, if we can't sort out how to keep an indexed gray image (color
 type 3) from being converted to grayscale+alpha (color type 4), then it is
 at least beneficial to limit the colors to the same number as the original
 upload.

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


More information about the wp-trac mailing list