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.
resource imagecreatefromwbmp(string $filename)
imagecreatefromwbmp() takes only one parameter, $filename. It holds the name of the image.
imagecreatefromwbmp() returns an image resource identifier on success, and it gives an error on false.
<?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); ?>
Note − The above PHP code will load the content into the browser in the unsupported form text as browsers don't support WBMP.
<?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.