B-219 Sec-55 Noida, India

Negative effect on an image using PHP

Below is the code for converting a image to Negative

$img = imagecreatefrompng(‘images.png’);

Here images.png is original image and negative.png is the converted negative 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 negative in gif format, use imagejpeg() for jpeg format,imagebmp for bmp format.

Say thanks in comment if it helps you 🙂

(Visited 280 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.