class RemoveBackground extends EffectAction

Class RemoveBackground

Makes the background of an image transparent (or solid white for JPGs).

Use when the background is a uniform color.

Learn more: Background removal

Methods

__construct(bool $screen = false, string|Color $colorToRemove = null)

RemoveBackground constructor.

screen(bool $screen = true)

Provides better results for images with near perfect green/blue background.

colorToRemove(string|Color $colorToRemove)

Overrides the algorithm's choice of background color.

Details

__construct(bool $screen = false, string|Color $colorToRemove = null)

RemoveBackground constructor.

Parameters

Name Type Description
$screen bool When true, provides better results for images with near perfect green/blue background.
$colorToRemove string|Color The background color as an RGB/A hex code. Overrides the algorithm's choice of background color. Default: The algorithm's choice - often the edge color of the image.

RemoveBackground screen(bool $screen = true)

Provides better results for images with near perfect green/blue background.

Parameters

Name Type Description
$screen bool Whether to use "screen" mode.

Return Value

RemoveBackground

RemoveBackground colorToRemove(string|Color $colorToRemove)

Overrides the algorithm's choice of background color.

Parameters

Name Type Description
$colorToRemove string|Color The background color as an RGB/A hex code.

Return Value

RemoveBackground

Constants

SCREEN

COLOR_TO_REMOVE