Convert a PNG image to GIF using imagegif() in PHP

Description

The following code shows how to convert a PNG image to GIF using imagegif().

Example


<?php//  ww  w  .j a  v a 2 s .  c o m

// Load the PNG
$png = imagecreatefrompng('./test.png');

// Save the image as a GIF
imagegif($png, './php.gif');

// Free from memory
imagedestroy($png);

// We're done
echo 'Converted PNG image to GIF with success!';
?>

The code above generates the following result.

Convert a PNG image to GIF using imagegif() in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text