imagebmp
PHP function
Edit on GitHub ✎
(PHP 7 >= 7.2.0, PHP 8)
Output a BMP image to browser or file
Description
imagebmp(GdImage $image, resource|string|null $file = null, bool $compressed = true): bool
Outputs or saves a BMP version of the given image.
Parameters
filePath
Notenull is invalid if the
compressedarguments is not used.compressedWhether the BMP should be compressed with run-length encoding (RLE), or not.
Return Values
Success
Trueonerror
Changelog
| Version | Description |
|---|---|
| 8.0.0 | The type of compressed is Boolean now; formerly it was Integer. |
Examples
Saving a BMP file
php
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'BMP with PHP', $text_color);
// Save the image
imagebmp($im, 'php.bmp');
?>