views:

104

answers:

1

Here's the thing.

I hava a simple snippet in PHP like this regarding a transparent image:

$im = new Imagick('some-transparent-image.png');
$im->setImageOpacity(0.3);
$im->writeImage('output.png');

The file output should be a transparent image with lower opacity, right?

Well, the output is an image with black color where it was supposed to be transparent and the image opacity is exactly the same.

Does it have to do with configuration or am i missing something?

Thank you in advance

+1  A: 

setImageOpacity unfortunately affects the whole image, so to leave the transparent areas transparent replace $im->setImageOpacity(0.3); with :

$im->evaluateImage(Imagick::EVALUATE_MULTIPLY, 0.3, Imagick::CHANNEL_ALPHA);

Paul
Thnx for the reply, i'll try that out and let you know if it works :)
Fotis
Hey, did you manage to get it working in the end?
Paul