class AutoGradientBackground extends AutoBackground

Automatically sets the background color when resizing with padding.

Learn more: Content-aware padding

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 color.

__construct(string $mode, int|string $gradientColors = null, string $gradientDirection = null)

AutoGradientBackground 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.

type(string $type)

Determines which color is automatically chosen for the background.

contrast()

Inverse the color.

palette(array|Palette ...$colors)

Use the palette of colors.

gradientColors(int|string $gradientColors)

Sets the number of gradient colors to select.

gradientDirection(string $direction)

Sets the the direction to blend the colors together.

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

$this color(string $color)

Sets the color.

Parameters

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

Return Value

$this

__construct(string $mode, int|string $gradientColors = null, string $gradientDirection = null)

AutoGradientBackground constructor.

Parameters

Name Type Description
$mode string The auto background mode.
$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.

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

AutoBackground type(string $type)

Determines which color is automatically chosen for the background.

Parameters

Name Type Description
$type string Use the constants defined in this class.

Return Value

AutoBackground

AutoBackground contrast()

Inverse the color.

Return Value

AutoBackground

AutoBackground palette(array|Palette ...$colors)

Use the palette of colors.

Parameters

Name Type Description
...$colors array|Palette The palette of colors

Return Value

AutoBackground

$this gradientColors(int|string $gradientColors)

Sets the number of gradient colors to select.

Parameters

Name Type Description
$gradientColors int|string Possible values: 2 or 4. Default: 2

Return Value

$this

$this gradientDirection(string $direction)

Sets the the direction to blend the colors together.

Parameters

Name Type Description
$direction string The direction. Use the constants defined in the GradientDirection class.

Return Value

$this

See also

GradientDirection

Constants

AUTO

MODE

PALETTE

BORDER

Selects the predominant color while taking only the image border pixels into account. (Server default)

PREDOMINANT

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

BORDER_GRADIENT

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

PREDOMINANT_GRADIENT

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

GRADIENT_COLORS

DIRECTION