Problem with composition of pseudo image

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
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 is below:

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