[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
Sun Jun 8 11:54:19 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 has-unit- | Focuses:
tests changes-requested |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords:
has-patch has-test-info dev-feedback commit fixed-major needs-unit-
tests
=> has-patch has-test-info has-unit-tests changes-requested
Comment:
Replying to [comment:84 siliconforks]:
> Note that the PR should work with all existing tests. I know
[https://core.trac.wordpress.org/ticket/63448#comment:64 I suggested
earlier that we might need to remove a test], but that is no longer
necessary - that test should pass with the current PR.
As I said, I would simply ignore all around the `COLORSPACE_GRAY` thing as
[https://core.trac.wordpress.org/ticket/63448#comment:64 you showed here]
is not trustworthy at all.
For the tests, AFAIK, they are correct: They are first checking that size
is not increasing (first problem), second they are checking that the
colour type doesn't change (second problem) and now they are checking that
the alpha channel bits don't change (third problem).
I think we have now everything covered.
Here I'm going to provide some performance testing based on my solution
and yours for multiple images. For this topic, I've run some performance
tasks and here are the results:
@siliconforks version:
https://gist.github.com/SirLouen/0187eddadd4a924cf20986e678baccfc
My version:
https://gist.github.com/SirLouen/953278594c8db7daec33452894dc9802
As we can see, in terms of size reduction, both methods are totally
identical
But in terms of processing, my method of using `png8` for non-true alpha
is way better, which can be seen in both `test8.png` and `rabbit-time-
paletted-or8.png`
Again, I'm not 100% sure what algorithm is being used in `png8` but it
simply works, and it was the sole reason of why I removed the quantize
function in my previous patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63448#comment:85>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list