hello,
how can I add opacity to an image? It's important to preserve the transparency in PNG's and GIF's.x
The following seems to do nothing:
$image=new Imagick($file);
$image->setImageType(Imagick::IMGTYPE_TRUECOLORMATTE);
$image->evaluateImage(Imagick::EVALUATE_SUBTRACT, $opacity,
Imagick::CHANNEL_OPACITY);
$image->writeImage($file_new);
and this seems to add opacity, but when opening the picture, I can see only a black square
$image=new Imagick($file);
$image->setImageOpacity(round($opacity/100,1));
$image->writeImage($file_new);
what can I do?
nico
how to add opacity to image?
Re: how to add opacity to image?
Hi,
can i see the image youre processing?
can i see the image youre processing?
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
hotzenplotz
Re: how to add opacity to image?
Hi,
there was a little error in my description. Right is, that the first statement does nothing and the second adds opacity to complete image, so I can see the partially transparent square on a colored background. For testing I'm using the "Silk Icons" from http://www.famfamfam.com/lab/icons/silk/ (ie female.png).
Nico
there was a little error in my description. Right is, that the first statement does nothing and the second adds opacity to complete image, so I can see the partially transparent square on a colored background. For testing I'm using the "Silk Icons" from http://www.famfamfam.com/lab/icons/silk/ (ie female.png).
Nico
-
hotzenplotz
SOLVED Re: how to add opacity to image?
hi,
$image->evaluateImage(Imagick::EVALUATE_MULTIPLY, 0.3,
Imagick::CHANNEL_OPACITY);
works as expected. now I'm still looking for a solution to display animated gif through PHP API in browser...
thanks
$image->evaluateImage(Imagick::EVALUATE_MULTIPLY, 0.3,
Imagick::CHANNEL_OPACITY);
works as expected. now I'm still looking for a solution to display animated gif through PHP API in browser...
thanks
Re: how to add opacity to image?
you need to send correct headers and use the getImagesBlob method.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
hotzenplotz
Re: how to add opacity to image?
header('Content-type: image/gif'); should be right, but the real problem seems to be the gif handling by imagick, see http://imagemagick.org/discourse-server ... =1&t=11579mkoppanen wrote:you need to send correct headers and use the getImagesBlob method.
whatever I do to load the gif file in imagick, only the first frame is rendered...
$image=file_get_contents("image.gif");
header(...);
echo $image;
works, but simple script
$image=file_get_contents("image.gif");
header(...);
$im=new Imagick();
$im->readImageBlob($image);
echo $im->getImageBlob();
shows first frame...
Re: how to add opacity to image?
Can you re-read what I posted? This time with care.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
hotzenplotz
Re: how to add opacity to image?
I've re-read it for times and noticed, that you wrote getImagesBlob, but when looking into php documentation of imagick, this function call is not documented. alls works perfectly. great thanks.
Who is online
Users browsing this forum: No registered users and 4 guests