1<?php 2print "--- Testing casts\n"; 3 4try { 5 $im = new Imagick(); 6 $im->newImage(100, 100, "red"); 7 $im->tintImage("red", "gray(50%)"); 8 echo "Casting color and opacity succeeded\n"; 9} catch (Exception $e) { 10 echo "Casting color and opacity failed: " , $e->getMessage() . PHP_EOL; 11} 12 13try { 14 $im = new Imagick(); 15 $pixel = new ImagickPixel("red"); 16 $strengthPixel = new ImagickPixel("gray"); 17 $im->newImage(100, 100, $pixel); 18 $im->tintImage($pixel, $strengthPixel); 19 echo "Setting color and opacity without cast succeeded\n"; 20} catch (Exception $e) { 21 echo "Setting color and opacity without cast failed: " , $e->getMessage() . PHP_EOL; 22} 23 24?> 25