WP_Image_Editor_Imagick::remove_pdf_alpha_channel()
Removes PDF alpha after it's been read.
Method of the class: WP_Image_Editor_Imagick{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->remove_pdf_alpha_channel();
Changelog
Since 6.4.0 | Introduced. |
WP_Image_Editor_Imagick::remove_pdf_alpha_channel() WP Image Editor Imagick::remove pdf alpha channel code WP 6.7.1
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 ) { try { // Imagick::ALPHACHANNEL_REMOVE mapped to RemoveAlphaChannel in PHP imagick 3.2.0b2. $this->image->setImageAlphaChannel( defined( 'Imagick::ALPHACHANNEL_REMOVE' ) ? Imagick::ALPHACHANNEL_REMOVE : 12 ); } catch ( Exception $e ) { return new WP_Error( 'pdf_alpha_process_failed', $e->getMessage() ); } } }