https://github.com/jindrapetrik/php-imagebw
PHP Functions for converting image to greyscale and to black and white.
https://github.com/jindrapetrik/php-imagebw
blackandwhite greyscale image php
Last synced: 2 months ago
JSON representation
PHP Functions for converting image to greyscale and to black and white.
- Host: GitHub
- URL: https://github.com/jindrapetrik/php-imagebw
- Owner: jindrapetrik
- License: lgpl-2.1
- Created: 2022-02-19T21:47:52.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-19T21:52:51.000Z (about 3 years ago)
- Last Synced: 2025-01-20T12:46:05.379Z (4 months ago)
- Topics: blackandwhite, greyscale, image, php
- Language: PHP
- Homepage:
- Size: 12.7 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-imagebw
PHP Functions for converting image to greyscale and to black and white.## Usage
Simply include `imagebw.php` in your project and start using
`imagegreyscale` and `imagebw` functions - see docs below.## Function docs
```php
/**
* Converts image to greyscale
* @param resource|GdImage $img
*/
function imagegreyscale($img): void;/**
* Converts image to black and white image
* @param resource|GdImage $img
* @param int $type See BW_ constants
*/
function imagebw($img, int $type): void;
```## Methods of black and white conversion - `BW_` constants
For second parameter of `imagebw` a `$type` of conversion is needed.You can use following constants:
```php
/**
* Nearest color
*/
define("BW_NORMAL", 0);
/**
* Floyd/Steinenberg
*/
define("BW_FLOID", 1);
/**
* Stucki
*/
define("BW_STUCKI", 2);
/**
* Burkes
*/
define("BW_BURKES", 3);
/**
* Bayer
*/
define("BW_BAYER", 4);
```## License
The library is licensed under GNU/LGPL v2.1, see [LICENSE](LICENSE)
for details.## Author
Jindra Petřík aka JPEXS## Changelog
Changes in versions are logged in the file [CHANGELOG.md](CHANGELOG.md)