Skip to content

PHP Functions for converting image to greyscale and to black and white.

License

Notifications You must be signed in to change notification settings

jindrapetrik/php-imagebw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

/**
 * 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:

/**
 * 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 for details.

Author

Jindra Petřík aka JPEXS

Changelog

Changes in versions are logged in the file CHANGELOG.md

About

PHP Functions for converting image to greyscale and to black and white.

Topics

Resources

License

Stars

Watchers

Forks

Languages