Ejemplo n.º 1
0
 *  4- $width -> end x coordinate
 *  5- $height -> end y coordinate
 * 
 */
/**
 * Load The Image From Source File
 */
$path = "../../src.jpg";
$image = tulipIP::loadImage($path);
/**
 * Appley gray filter for the second half of the gd resource ($image) only
 */
$dest = "./";
$x = floor(tulipIP::getWidth($image) / 2);
$y = 0;
$width = tulipIP::getWidth($image);
$height = tulipIP::getHeight($image);
$copy = tulipIP::gdClone($image);
tulipIP::gray_part($copy, $x, $y, $width, $height);
tulipIP::saveImage($dest, $copy, TIP_PNG, 'gray_part');
imagedestroy($copy);
/**
 * apply gray filter for the given gd resource except the selected area
 * where selected area is Square (100*100) in the top left corner of the image
 */
$copy = tulipIP::gdClone($image);
tulipIP::gray_invert($copy, 0, 0, 100, 100);
tulipIP::saveImage($dest, $copy, TIP_PNG, 'gray_invertr');
imagedestroy($copy);
// destroy the source
imagedestroy($image);