Apply a 3x3 convolution matrix, using coefficient and offset in PHP

Description

The following code shows how to apply a 3x3 convolution matrix, using coefficient and offset.

Example


<?php//ww w  .ja  v  a2  s.  co  m
$image = imagecreatefromgif('http://www.php.net/images/php.gif');

$emboss = array(array(2, 0, 0), array(0, -1, 0), array(0, 0, -1));
imageconvolution($image, $emboss, 1, 127);

header('Content-Type: image/png');
imagepng($image, null, 9);
?>

The code above generates the following result.

Apply a 3x3 convolution matrix, using coefficient and offset in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text