Problem with composition of pseudo image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rbostan
Posts: 3
Joined: 2013-05-23T07:54:59-07:00
Authentication code: 6789

Problem with composition of pseudo image

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with composition of pseudo image

Post 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
Post Reply