Page 1 of 1

Problem with composition of pseudo image

Posted: 2013-05-29T01:02:41-07:00
by rbostan
Hi all,
I'm trying to generate gradient scene with imagick.
Everything is working on local environment very well (ImageMagick 6.7.6-1 2012-03-17 Q16 on Win7 with ZendServer).
http://snag.gy/vMHFr.jpg

when uploaded to the server (ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP on CentOS 6.4 Final, x86_64 ), composition of pseudo image not working.
http://snag.gy/0Lise.jpg

Code: Select all

    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    header("Content-Type: image/png");
            $holder=new Imagick("/path/to/image.png");
            $reflection = $holder->clone();
       $reflection->setimagematte(true);
       $reflection->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
       $reflection->flipImage();

       $gradient = new Imagick();
       $gradient->newPseudoImage($reflection->getImageWidth(), $reflection->getImageHeight()+10, "gradient:transparent-gray35");
       $reflection->compositeImage($gradient, Imagick::COMPOSITE_OVER, 0,-1);
       $reflection->setImageOpacity( 0.15 );
       $reflection->blurimage(14,2);
       $reflection->setpage($reflection->getImageWidth(), $reflection->getImageHeight()+10,0,0);
       $canvas=new Imagick();
       $canvas->newPseudoImage($holder->getImageWidth()*1.5, $holder->getImageHeight()*3, "gradient:gray5-gray50");
       $canvas->setimageformat('png');
       $canvas->compositeImage($reflection, Imagick::COMPOSITE_OVER, ($canvas->getimagewidth()-$holder->getimagewidth())/2, (($canvas->getimageheight()-$holder->getimageheight())/2)+$holder->getImageHeight()+2);
       $canvas->compositeImage($holder, Imagick::COMPOSITE_OVER, ($canvas->getimagewidth()-$holder->getimagewidth())/2, ($canvas->getimageheight()-$holder->getimageheight())/2);
       echo $canvas;
Thanks for help.

Re: Problem with composition of pseudo image

Posted: 2013-05-29T09:57:38-07:00
by fmw42
Your server has a very ancient version of IM. That could be the problem. Also be sure that both systems are using the latest version of Imagick. see http://pecl.php.net/package/imagick/3.1.0RC2