Copy and merge part of an image with gray scale in PHP

Description

The following code shows how to copy and merge part of an image with gray scale.

Example


<?php/*w  w  w  . j a va  2  s. c om*/
// Create image instances
$dest = imagecreatefromgif('php.gif');
$src = imagecreatefromgif('php.gif');

// Copy and merge - Gray = 20%
imagecopymergegray($dest, $src, 10, 10, 0, 0, 100, 47, 20);

// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);

imagedestroy($dest);
imagedestroy($src);
?>

The code above generates the following result.

Copy and merge part of an image with gray scale in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text