[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
Tue May 27 19:59:31 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 adamsilverstein):
Here is the relevant bit of code that we had in place previously:
{{{
// Reduce colors in the images to maximum needed, using the global
colorspace.
$max_colors = pow( 2, $indexed_pixel_depth );
if ( is_callable( array( $this->image, 'getImageColors' ) ) ) {
$current_colors = $this->image->getImageColors();
$max_colors = min( $max_colors, $current_colors );
}
$this->image->quantizeImage( $max_colors, $this->image->getColorspace(),
0, false, false );
/**
* If the colorspace is 'gray', use the png8 format to ensure it stays
indexed.
*/
if ( Imagick::COLORSPACE_GRAY === $this->image->getImageColorspace() ) {
$this->image->setOption( 'png:format', 'png8' );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63448#comment:73>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list