diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php index d38ee6fd631ee..eac302d7ceb9a 100644 --- a/src/wp-includes/class-wp-image-editor-imagick.php +++ b/src/wp-includes/class-wp-image-editor-imagick.php @@ -775,9 +775,8 @@ public function save( $destfilename = null, $mime_type = null ) { * @since 6.4.0 */ protected function remove_pdf_alpha_channel() { - $version = Imagick::getVersion(); // Remove alpha channel if possible to avoid black backgrounds for Ghostscript >= 9.14. RemoveAlphaChannel added in ImageMagick 6.7.5. - if ( $version['versionNumber'] >= 0x675 ) { + if ( version_compare( phpversion( 'imagick' ), '9.14', '>=' ) ) { try { // Imagick::ALPHACHANNEL_REMOVE mapped to RemoveAlphaChannel in PHP imagick 3.2.0b2. $this->image->setImageAlphaChannel( defined( 'Imagick::ALPHACHANNEL_REMOVE' ) ? Imagick::ALPHACHANNEL_REMOVE : 12 );