Home Tutorial Php Phpgd PHP GD image filter

 
 

PHP GD image filter
Posted on: November 12, 2009 at 12:00 AM
This example shows how to filter an image in php gd.

<?php

$logo1 = imagecreatefromjpeg('images.jpg');

$logo2 = imagecreatefromjpeg('images.jpg');

$output = imagecreatetruecolor(imagesx($logo1) * 2, imagesy($logo1));

imagefilter($logo1, IMG_FILTER_PIXELATE, 3);

imagefilter($logo2, IMG_FILTER_PIXELATE, 3, true);

imagecopy($output, $logo1, 0, 0, 0, 0, imagesx($logo1) - 1, imagesy($logo1) - 1);

imagecopy($output, $logo2, imagesx($logo2), 0, 0, 0, imagesx($logo2) - 1, imagesy($logo2) - 1);

imagedestroy($logo1);

imagedestroy($logo2);

header('Content-Type: image/jpeg');

imagejpeg($output);

imagedestroy($output);

?>

After running the program you will get the following output

Related Tags for PHP GD image filter:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.