class Background extends BaseQualifier

Defines the background color to use instead of transparent background areas or when resizing with padding.

Learn more: Setting background for images | Setting background for videos

Methods

border()

Selects the predominant color while taking only the image border pixels into account.

predominant()

Selects the predominant color while taking all pixels in the image into account.

borderGradient(int|string $gradientColors = null, string $gradientDirection = null)

Base the gradient fade effect on the predominant colors in the border pixels of the image.

predominantGradient(int|string $gradientColors = null, string $gradientDirection = null)

Base the gradient fade effect on the predominant colors in the image.

color(string $color)

Sets the background color.

__construct($color)

Background constructor.

blurred(int $intensity = null, int $brightness = null)

Applies blurred background (Relevant only for videos).

auto(string $autoBackground = null)

Applies background color automatically.

generativeFill(string|array $prompt = null, bool $ignoreForeground = null)

Applies generative AI background.

Details

static AutoBackground border()

Selects the predominant color while taking only the image border pixels into account.

Return Value

AutoBackground

static AutoBackground predominant()

Selects the predominant color while taking all pixels in the image into account.

Return Value

AutoBackground

static AutoGradientBackground borderGradient(int|string $gradientColors = null, string $gradientDirection = null)

Base the gradient fade effect on the predominant colors in the border pixels of the image.

Parameters

Name Type Description
$gradientColors int|string The number of gradient colors to select. Possible values: 2 or 4. Default: 2
$gradientDirection string The direction. Use the constants defined in the GradientDirection class.

Return Value

AutoGradientBackground

static AutoGradientBackground predominantGradient(int|string $gradientColors = null, string $gradientDirection = null)

Base the gradient fade effect on the predominant colors in the image.

Parameters

Name Type Description
$gradientColors int|string The number of gradient colors to select. Possible values: 2 or 4. Default: 2
$gradientDirection string The direction. Use the constants defined in the GradientDirection class.

Return Value

AutoGradientBackground

static Background color(string $color)

Sets the background color.

Parameters

Name Type Description
$color string The color. Can be RGB, HEX, named color, etc.

Return Value

Background

__construct($color)

Background constructor.

Parameters

Name Type Description
$color

static BlurredBackground blurred(int $intensity = null, int $brightness = null)

Applies blurred background (Relevant only for videos).

Parameters

Name Type Description
$intensity int The intensity of the blur.
$brightness int The brightness of the background.

Return Value

BlurredBackground

static AutoBackground auto(string $autoBackground = null)

Applies background color automatically.

Parameters

Name Type Description
$autoBackground string The type of the background color. See AutoBackground class.

Return Value

AutoBackground

See also

AutoBackground

static GenerativeFillBackground generativeFill(string|array $prompt = null, bool $ignoreForeground = null)

Applies generative AI background.

Parameters

Name Type Description
$prompt string|array Use natural language to describe what generate in the image.
$ignoreForeground bool Whether to take foreground elements into account.

Return Value

GenerativeFillBackground