1--TEST-- 2Test Imagick, tintImage 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8$r = 100; 9$g = 50; 10$b = 100; 11$a = 100; 12 13function tintImage($r, $g, $b, $a) { 14 $a = $a / 100; 15 16 $imagick = new \Imagick(); 17 $imagick->newPseudoImage(400, 400, 'gradient:black-white'); 18 19 $tint = new \ImagickPixel("rgb($r, $g, $b)"); 20 $opacity = new \ImagickPixel("rgb(128, 128, 128, $a)"); 21 $imagick->tintImage($tint, $opacity); 22 $imagick->setImageFormat('png'); 23 $bytes = $imagick->getImageBlob(); 24 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 25} 26 27tintImage($r, $g, $b, $a) ; 28echo "Ok"; 29?> 30--EXPECTF-- 31Ok