File: gmagick-112_colorizeImage_basic.phpt

package info (click to toggle)
php-gmagick 2.0.6~rc1%2B%2B-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,660 kB
  • sloc: ansic: 6,890; php: 330; xml: 267; pascal: 5; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
Test Gmagick, colorizeImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php

$color = 'rgb(127, 127, 127)';
$opacity = 100;

function colorizeImage($color, $opacity) {
    $gmagick = new \Gmagick("magick:logo");
    $opacity = $opacity / 255.0;
    $opacityColor = new \GmagickPixel("rgba(0, 0, 0, $opacity)");
    $gmagick->colorizeImage($color, $opacityColor);
    $bytes = $gmagick->getImageBlob();
    if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 
}

colorizeImage($color, $opacity) ;
echo "Ok";
?>
--EXPECTF--
Ok