class BlackWhite extends OnPixelBased implements FilterInterface

This filter calculates, for each pixel of an image, whether it is ligher or darker than a threshold.

If the pixel is lighter than the thresold it will be black, otherwise it will be light. The result is an image with only black and white pixels (black pixels for ligher colors, white pixels for darker colors).

Properties

protected callable $callback from OnPixelBased
protected Grayscale $grayScaleFilter

Methods

__construct(int $threshold)

Initialize this filter.

apply(ImageInterface $image)

Applies scheduled transformation to an ImageInterface instance.

Details

at line 40
__construct(int $threshold)

Initialize this filter.

Parameters

int $threshold the dask/light threshold, from 0 (all black) to 255 (all white)

Exceptions

InvalidArgumentException

at line 62
ImageInterface apply(ImageInterface $image)

Applies scheduled transformation to an ImageInterface instance.

Parameters

ImageInterface $image

Return Value

ImageInterface returns the processed ImageInterface instance

See also

OnPixelBased::apply