PHP | imagebmp() Function Last Updated : 28 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The imagebmp() function is an inbuilt function in PHP which is used to return the output or save a BMP version of the given image. Syntax: bool imagebmp( resource $image, mixed $to, bool $compressed ) Parameters: This function accept three parameters as mentioned above and described below: $image: It specifies the image to be converted. $to (Optional): It specifies the path to save file to. $compressed (Optional): It specifies whether BMP should be compressed with run-length encoding or not. Return Value: This function returns TRUE on success. Exceptions: This function throws Exception on error. Below given programs illustrate the imagebmp() function in PHP: Program 1 (Creating a bmp image from scratch): php <?php // Create a blank image $im = imagecreatetruecolor(120, 100); // Add text in image $text_color = imagecolorallocate($im, 200, 240, 21); imagestring($im, 1, 5, 50, 'GeeksforGeeks', $text_color); // Output that image as bmp header("Content-Type: image/bmp"); imagebmp($im); ?> Output: Program 2 (Converting a image into bmp): php <?php // Create a image from URL $im = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Output that image as bmp header("Content-Type: image/bmp"); imagebmp($im); ?> Output: Reference: https://www.php.net/manual/en/function.imagebmp.php Comment More info G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like