Select your language

How to show a png image with transparent background using Imagick in PHP
Photo from Unsplash

Hello super joomlers!

After searching the web, the official website, php documentation and forums, I found, at last, the solution thanks to a friend's suggestion : "What if it was just the image background?"

Sure enough, by analysing the code of Imagick library using my favourite PHP IDE PhpStorm, I discovered the right method to call just after the Imagick constructor. Here is some sample code.

 $image = new Imagick('example.png'); 
$image->setImageAlphaChannel(Imagick::ALPHACHANNEL_ACTIVATE);

It's your turn now! Happy coding!

Super Joomlers! Get the most out of Joomla!
We hate spam as much as you do and we will not send you email without your prior consent. You can unsubscribe / resubscribe any time you want.