php8.5
Home/ Manual/ image / functions/ imagecreatefrombmp

imagecreatefrombmp

PHP function Edit on GitHub ✎

(PHP 7 >= 7.2.0, PHP 8)

New

Description

imagecreatefrombmp(string $filename): GdImage|false

imagecreatefrombmp() returns an image identifier representing the image obtained from the given filename.

Fopen-wrapper

Parameters

filename

Path to the BMP image.

Return Values

Identifier

Changelog

VersionDescription
8.0.0On success, this function returns a GDImage instance now; previously, a resource was returned.

Examples

Convert an BMP image to a PNG image using imagecreatefrombmp()

php
<?php
// Load the BMP file
$im = imagecreatefrombmp('./example.bmp');

// Convert it to a PNG file with default settings
imagepng($im, './example.png');
?>

Source: reference/image/functions/imagecreatefrombmp.xml · from the official PHP manual (php/doc-en)