https://github.com/jindrapetrik/php-bmp
Bitmap support for PHP
https://github.com/jindrapetrik/php-bmp
bitmap bmp php
Last synced: 2 months ago
JSON representation
Bitmap support for PHP
- Host: GitHub
- URL: https://github.com/jindrapetrik/php-bmp
- Owner: jindrapetrik
- License: lgpl-2.1
- Created: 2022-02-15T18:02:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-16T17:00:14.000Z (over 3 years ago)
- Last Synced: 2025-01-20T12:46:06.798Z (4 months ago)
- Topics: bitmap, bmp, php
- Language: PHP
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# php-bmp
Bitmap image support for PHPThis started because in the past there was no support for generating/reading Bitmap (BMP) files in PHP.
PHP has built-in function `imagecreatefrombmp` and `imagebmp` since version 7.2,
but as of my testing - not all BMP file formats are supported.This project contains own implementation of `imagecreatefrombmp` and `imagebmp` functions.
## Usage
```php
//include lib first
require_once 'bmp.php';//for PHP before 7.2
$img = imagecreatefrombmp("file.bmp");
//...
header("Content-type: image/bmp");
imagebmp($img);//for PHP 7.2 and newer (if you want to use new BMP file formats)
use Com\Jpexs\Image\Bitmap;
$bmp = new Bitmap();
$img = $bmp->imageCreateFromBmp("file.bmp");
//...
header("Content-type: image/bmp");
$bmp->imageBmp($img);```
## Supported file formats
BI_RGB, BI_RLE8, BI_RLE4, BI_BITFIELDS## Author
Jindra Petřík aka JPEXS## License
The library is licensed under GNU/LGPL v2.1## Changelog
Changes in versions are logged in the file [CHANGELOG.md](CHANGELOG.md)