1--TEST--
2Test Imagick, colorizeImage
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11$color = 'rgb(127, 127, 127)';
12$opacity = 100;
13
14function colorizeImage($color, $opacity) {
15    $imagick = new \Imagick();
16    $imagick->newPseudoImage(640, 480, "magick:logo");
17    $opacity = $opacity / 255.0;
18    $opacityColor = new \ImagickPixel("rgba(0, 0, 0, $opacity)");
19    $imagick->colorizeImage($color, $opacityColor);
20    $bytes = $imagick->getImageBlob();
21    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
22}
23
24colorizeImage($color, $opacity) ;
25
26$imagick = new \Imagick();
27$imagick->newPseudoImage(640, 480, "magick:logo");
28$opacity = $opacity / 255.0;
29$opacityColor = new \ImagickPixel("rgba(0, 0, 0, $opacity)");
30// TODO - legacy mode of setting fraction as transparency needs
31// to be removed.
32$imagick->colorizeImage($color, 0.5, true);
33$bytes = $imagick->getImageBlob();
34if (strlen($bytes) <= 0) { echo "Failed to generate image for legacy mode.";}
35
36echo "Ok";
37?>
38--EXPECTF--
39Ok