Below is the code for converting a image using Sepia Effect
<?php
$img = imagecreatefrompng(‘images.png’);
imagefilter($img,IMG_FILTER_GRAYSCALE);
imagefilter($img,IMG_FILTER_COLORIZE,100,50,0);
imagepng($img,’sepia.png’);
imagedestroy($img);
?>
Here images.png is original image and sepia.png is the converted sepia image.
In the first line of code use imagecreatefromgif() if you are converting a gif image ,use imagecreatefromjpeg() if you are converting a jpeg image, user imagecreatefrombmp() if you are converting a bmp image
Similarly in line 3 use imagegif() for creating sepia in gif format, use imagejpeg() for jpeg format,imagebmp for bmp format.
Say thanks in comment if it helps you 🙂
(Visited 266 times, 1 visits today)