PHP | imagecreatefromgif() Function Last Updated : 30 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The imagecreatefromgif() function is an inbuilt function in PHP which is used to create a new image from a given part of GIF file or URL. Further, this image can be worked upon in the program. This function only loads the first frame of the animation. Syntax: resource imagecreatefromgif( string $filename ) Parameters: This function accepts a single parameter $filename which holds the image. Return Value: This function returns an image resource identifier on success, FALSE on errors. Below examples illustrate the imagecreatefromgif() function in PHP: Example 1: Loading first frame in browser. php <?php // Create an image from gif $im = imagecreatefromgif( 'https://media.geeksforgeeks.org/wp-content/uploads/20191117145951/g4gnaimation1.gif'); // View the image header("Content-Type: image/gif"); imagegif($im); imagedestroy($im); ?> Output: Example 2: Saving first frame as JPG in local folder php <?php // Create an image from gif $im = imagecreatefromgif( 'https://media.geeksforgeeks.org/wp-content/uploads/20191117145951/g4gnaimation1.gif'); // Save the image as jpeg imagejpeg($im, 'firstframe.jpg'); imagedestroy($im); ?> Output: This will save the first frame as firstframe.jpg in the same folder. Note: Only the first frame is returned in the image resource pointer. Reference: https://www.php.net/manual/en/function.imagecreatefromgif.php Comment More infoAdvertise with us Next Article PHP | imagecreatefromgif() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | imagecreatefromgd() function The imagecreatefromgd() function is an inbuilt function in PHP which is used to create a new image from GD file or URL. Further, this image can be worked upon in the program. An image can be converted into GD format using the imagegd() function. Syntax: resource imagecreatefromgd( string $filename ) 2 min read PHP | imagecreatefromgd2() function The imagecreatefromgd2() function is an inbuilt function in PHP which is used to create a new image from file or URL. Further, this image can be worked upon in the program. Usually, gd2 extension is not supported in the browser thus it can be used to convert it into png and view it in the browser.Sy 1 min read PHP | imagecreatefrompng() Function The imagecreatefrompng() function is an inbuilt function in PHP which is used to create a new image from PNG file or URL. This image can be further worked upon in the program. This function is usually used when you want to edit your PNG images. Syntax: resource imagecreatefrompng( string $filename ) 1 min read PHP | imagecreatefromjpeg() Function The imagecreatefromjpeg() function is an inbuilt function in PHP which is used to create a new image from JPEG file or URL. This image can be further worked upon in the program. Syntax: resource imagecreatefromjpeg( string $filename ) Parameters: This function accepts a single parameter, $filename w 1 min read PHP | imagecreatefrombmp() Function The imagecreatefrombmp() function is an inbuilt function in PHP which is used to create a new image from file or URL. Syntax: resource imagecreatefrombmp( string $filename ) Parameters: This function accepts a single parameter $filename which holds the name or URL of a file. Return Value: This funct 1 min read Like