In PHP, imagecreatefromwbmp() is an inbuilt function that is used to create a new image from a WBMP file or URL. imagecreatefromwbmp() returns an image identifier representing the image obtained from the given filename. We can use imagecreatefromwbmp() whenever we want to edit the images after loading them from a WBMP file. Using the imagewbmp() function, an image can be converted into WBMP.
Syntax
resource imagecreatefromwbmp(string $filename)
Parameters
imagecreatefromwbmp() takes only one parameter, $filename. It holds the name of the image.
Return Values
imagecreatefromwbmp() returns an image resource identifier on success, and it gives an error on false.
Example 1
<?php // Loading the WBMP image from the local drive folder $img = imagecreatefromwbmp'C:\xampp\htdocs\pic.wbmp'); // 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 the unsupported form text as browsers don't support WBMP.
Example 2
<?php // Load a WBMP image from the local drive folder //We can convert the image to WBMP using the online converter //or using the imagewbmp() function $img = imagecreatefromwbmp('C:\xampp\htdocs\Images\img30.wbmp'); // Save the GIF image into the given local drive folder path. imagejpeg($img,'C:\xampp\htdocs\pic.gif'); imagedestroy($img); ?>
Original input image before using imagecreatefromwbmp()
Output Image after using imagecreatefromwbmp()
Note − WBMP is a Wireless Bitmap File Format. It is a WAP graphic format optimized for mobile computing devices. The pictures in the WBMP format are saved in bit format. That is, every pixel of an image is saved as 1 bit. To open the WBMP file, a wireless bitmap file format software is required.