[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 16 20:50:19 UTC 2025
#63448: Image quality significantly degrades for resized PNGs with transparency in
WordPress 6.8.1
-------------------------------------------------+-------------------------
Reporter: elvismdev | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.8.2
Component: Media | Version: 6.8
Severity: critical | Resolution:
Keywords: has-patch needs-testing needs-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by elvismdev):
Thanks everyone for the great input and collaborative investigation. I’ve
just updated my [https://github.com/WordPress/wordpress-develop/pull/8810
GitHub PR #8810] based on the recent insights shared here.
**What changed**:
* I removed reliance on `getImageDepth()` since it's not a reliable
indicator of whether a PNG is palette-based.
* Instead, I now use:
* `getImageColors()` to check if the image has 256 or fewer unique
colors.
* `getImageProperty( 'png:IHDR.color_type' )` to verify it’s an
**indexed PNG** (`color_type == 3`).
* Quantization is only applied when **both conditions are met**, which
ensures it won’t degrade quality on full-color PNGs or images with
gradients/transparency.
This logic seems to solve the issue without regressing the optimization
intent of [59589]. Grayscale (png8) and alpha chunk logic is preserved.
Let me know what you think, happy to iterate further if needed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63448#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list