1--TEST-- 2Test Imagick, compositeImage 3--SKIPIF-- 4<?php 5$imageMagickRequiredVersion=0x675; 6require_once(dirname(__FILE__) . '/skipif.inc'); 7?> 8--FILE-- 9<?php 10 11 12function compositeImage() { 13 14 $img1 = new \Imagick(); 15 $img1->newPseudoImage(640, 480, "magick:logo"); 16 17 $img2 = new \Imagick(); 18 $img2->newPseudoImage(640, 480, "magick:logo"); 19 $img2->negateImage(false); 20 $img2->blurimage(10, 5); 21 22 23 $img1->resizeimage( 24 $img2->getImageWidth(), 25 $img2->getImageHeight(), 26 \Imagick::FILTER_LANCZOS, 27 1 28 ); 29 30 $opacity = new \Imagick(); 31 $opacity->newPseudoImage( 32 $img1->getImageHeight(), 33 $img1->getImageWidth(), 34 "gradient:gray(10%)-gray(90%)" 35 ); 36 $opacity->rotateimage('black', 90); 37 38 $img2->compositeImage($opacity, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); 39 $img1->compositeImage($img2, \Imagick::COMPOSITE_ATOP, 0, 0); 40 41 $bytes = $img1->getImageBlob(); 42 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 43} 44 45compositeImage() ; 46echo "Ok"; 47?> 48--EXPECTF-- 49Ok