[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
Fri May 23 22:38:24 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:66 nosilver4u]:
 > I think the disconnect here is ''when'' one checks the image colorspace.
 I just tested on 22.04 with IM 6.9.11-60 as well and get
 Imagick::COLORSPACE_GRAY after quantizing the image.

 OK, I see that it works for me now if you run `quantizeImage` first, then
 call `getImageColorspace` - it returns `Imagick::COLORSPACE_GRAY`.

 However, the question then becomes: is that actually the right thing to
 check?  Suppose you have an image which is similar to the `oval-or8.png`
 image above, but grayscale.  Then won't that also be identified as
 `Imagick::COLORSPACE_GRAY`?  Then won't forcing it to `png8` destroy the
 alpha values in the image?

 I think what you probably want to check here is what @SirLouen alluded to
 above in https://core.trac.wordpress.org/ticket/63448#comment:61 - you
 want to check whether the image has 1-bit alpha transparency.  If so (or
 if it has no transparency at all), then it should be safe to use `png8`
 format; otherwise no.  But I'm not sure if there's an easy way to do that,
 or if it's even worth doing considering that this is probably only useful
 for a fairly rare edge case.

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


More information about the wp-trac mailing list