PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Bob Madjak's Blog: Making images transparent using Imagick - enter the pixel iterator

Note: This article was originally published at PHPDeveloper on 19 April 5751.
PHPDeveloper

In this recent post to his blog Bob Madjak looks at how to use the Imagick functionality to create images with transparent backgrounds.

So we have this image, and we want to set it to be 75% transparent using Imagick. This sounds simple enough, doesn't it? Perhaps we are trying to create a watermark, or we just want to fade the image for some reason.

He shows how to use the ImagickPixelIterator to take care of some of the issues that can be caused by just a call to "setImageOpacity". A code sample is included in the post showing how to take a source image and make it transparent without ending up with a white border/black background like the other version.