# How to create a new image from a WEBP file or URL using imagecreatefromwebp() function in PHP?

In PHP, imagecreatefromwebp() is an inbuilt PHP function that is used to create a new image from a WEBP file or URL. imagecreatefromwebp() returns an image identifier representing the image obtained from the given filename.

imagecreatefromwebp() can be used whenever we want to edit the images after loading them from a WEBP file. Using imagewebp(), an image can be converted into WBMP.

## Return Values

imagecreatefromwebp() returns an image resource identifier on success, and it gives an error on false.

## Example 1

<?php
$img = imagecreatefromwebp('C:\xampp\htdocs\Images\img31.webp'); // View the loaded image in the browser imagewbmp($img);
imagedestroy($img); ?> ## Output Note − The above PHP code will load the content into the browser in an unsupported form of text because the browser does not support the WEBP image format. ## Example 2 <?php // Load a WEBP image from the local drive folder //We can convert the image to WEBP using the online converter //or using the imagewebp() function$img = imagecreatefromwebp('C:\xampp\htdocs\Images\img31.webp');
imagejpeg($img,'C:\xampp\htdocs\pic.gif'); imagedestroy($img);
?>