trait ImageAdjustmentTrait

Trait ImageAdjustmentTrait

Methods

autoBrightness(int $blend = null)

Adjusts the brightness and blends the result with the original image.

autoColor(int $blend = null)

Adjusts the color balance and blends the result with the original image.

autoContrast(int $blend = null)

Adjusts the contrast and blends the result with the original image.

fillLight(int $blend = null, int $bias = null)

Adjusts the fill light and blends the result with the original image.

improve(int $blend = null, string $mode = null)

Adjusts the image colors, contrast and brightness.

vibrance(int $strength = null)

Applies a vibrance filter on the image.

viesusCorrect()

Enhances an image to its best visual quality with the Viesus Automatic Image Enhancement add-on.

red(int $level = null)

Adjusts the image's red channel.

green(int $level = null)

Adjusts the image's green channel.

blue(int $level = null)

Adjusts the image's blue channel.

brightnessHSB(int $level = null)

Adjusts image brightness modulation in HSB to prevent artifacts in some images.

hue(int $level = null)

Adjusts the image's hue.

tint(array ...$qualifiers)

Blends the image with one or more tint colors at the intensity specified.

replaceColor(string $toColor, int $tolerance = null, string $fromColor = null)

Maps an input color and those similar to the input color to corresponding shades of a specified output color, taking luminosity and chroma into account, in order to recolor an object in a natural way.

recolor(array ...$colorMatrix)

Converts the colors of every pixel in an image based on the supplied color matrix, in which the value of each color channel is calculated based on the values from all other channels (e.g. a 3x3 matrix for RGB, a 4x4 matrix for RGBA or CMYK, etc).

sharpen(int $strength = null)

Applies a sharpening filter to the image.

unsharpMask(int $strength = null)

Applies an unsharp mask filter to the image.

opacityThreshold(int $level = null)

Causes all semi-transparent pixels in an image to be either fully transparent or fully opaque.

opacity(float $level)

Adjusts the opacity of the image and makes it semi-transparent.

Details

static BlendEffectAction autoBrightness(int $blend = null)

Adjusts the brightness and blends the result with the original image.

Parameters

Name Type Description
$blend int How much to blend the adjusted brightness, where 0 means only use the original and 100 means only use the adjusted brightness result. (Range: 0 to 100, Server default: 100)

Return Value

BlendEffectAction

static BlendEffectAction autoColor(int $blend = null)

Adjusts the color balance and blends the result with the original image.

Parameters

Name Type Description
$blend int How much to blend the adjusted color result, where 0 means only use the original and 100 means only use the adjusted color result. (Range: 0 to 100, Server default: 100)

Return Value

BlendEffectAction

static BlendEffectAction autoContrast(int $blend = null)

Adjusts the contrast and blends the result with the original image.

Parameters

Name Type Description
$blend int How much to blend the adjusted contrast, where 0 means only use the original and 100 means only use the adjusted contrast result. (Range: 0 to 100, Server default: 100)

Return Value

BlendEffectAction

static FillLight fillLight(int $blend = null, int $bias = null)

Adjusts the fill light and blends the result with the original image.

Parameters

Name Type Description
$blend int How much to blend the adjusted fill light, where 0 means only use the original and 100 means only use the adjusted fill light result. Range: 0 to 100, Server default: 100)
$bias int The bias to apply to the fill light effect (Range: -100 to 100, Server default: 0).

Return Value

FillLight

static Improve improve(int $blend = null, string $mode = null)

Adjusts the image colors, contrast and brightness.

Use the constants defined in \Cloudinary\Transformation\Improve for $mode.

Parameters

Name Type Description
$blend int How much to blend the improved result with the original image, where 0 means only use the original and 100 means only use the improved result. (Range: 0 to 100, Server default: 100)
$mode string The improve mode. Use the constants defined in the Improve class.

Return Value

Improve

See also

Improve

static StrengthEffectAction vibrance(int $strength = null)

Applies a vibrance filter on the image.

Parameters

Name Type Description
$strength int The strength of the vibrance. (Range: -100 to 100, Server default: 20)

Return Value

StrengthEffectAction

static ViesusCorrect viesusCorrect()

Enhances an image to its best visual quality with the Viesus Automatic Image Enhancement add-on.

For details, see the Viesus Automatic Image Enhancement add-on documentation.

static LevelEffectAction red(int $level = null)

Adjusts the image's red channel.

Parameters

Name Type Description
$level int The level of red. (Range: -100 to 100, Server default: 0)

Return Value

LevelEffectAction

static LevelEffectAction green(int $level = null)

Adjusts the image's green channel.

Parameters

Name Type Description
$level int The level of green. (Range: -100 to 100, Server default: 0)

Return Value

LevelEffectAction

static LevelEffectAction blue(int $level = null)

Adjusts the image's blue channel.

Parameters

Name Type Description
$level int The level of blue. (Range: -100 to 100, Server default: 0)

Return Value

LevelEffectAction

static LevelEffectAction brightnessHSB(int $level = null)

Adjusts image brightness modulation in HSB to prevent artifacts in some images.

Parameters

Name Type Description
$level int The level of modulation. (Range: -99 to 100, Server default: 80)

Return Value

LevelEffectAction

static LevelEffectAction hue(int $level = null)

Adjusts the image's hue.

Parameters

Name Type Description
$level int The level of hue. (Range: -100 to 100, Server default: 80)

Return Value

LevelEffectAction

static EffectAction tint(array ...$qualifiers)

Blends the image with one or more tint colors at the intensity specified.

Optional - equalize colors before tinting, specify gradient blend positioning per color.

Parameters

Name Type Description
...$qualifiers array Syntax: [equalize]:[amount]:[color1]:[color1_position]:[color2]:[color2_position]:... [color10]:[color10_position]

Return Value

EffectAction

static ReplaceColor replaceColor(string $toColor, int $tolerance = null, string $fromColor = null)

Maps an input color and those similar to the input color to corresponding shades of a specified output color, taking luminosity and chroma into account, in order to recolor an object in a natural way.

More highly saturated input colors usually give the best results. It is recommended to avoid input colors approaching white, black, or gray.

Parameters

Name Type Description
$toColor string The HTML name or RGB/A hex code of the target output color.
$tolerance int The tolerance threshold (a radius in the LAB color space) from the input color, representing the span of colors that should be replaced with a correspondingly adjusted version of the target output color. Larger values result in replacing more colors within the image. The more saturated the original input color, the more a change in value will impact the result (Server default: 50).
$fromColor string The HTML name or RGB/A hex code of the base input color to map (Server default: the most prominent high-saturation color in the image).

Return Value

ReplaceColor

See also

ReplaceColor

static EffectAction recolor(array ...$colorMatrix)

Converts the colors of every pixel in an image based on the supplied color matrix, in which the value of each color channel is calculated based on the values from all other channels (e.g. a 3x3 matrix for RGB, a 4x4 matrix for RGBA or CMYK, etc).

For every pixel in the image, take each color channel and adjust its value by the specified values of the matrix to get a new value.

Parameters

Name Type Description
...$colorMatrix array The matrix of colors.

Return Value

EffectAction

static StrengthEffectAction sharpen(int $strength = null)

Applies a sharpening filter to the image.

Parameters

Name Type Description
$strength int The strength of the filter. (Range: 1 to 2000, Server default: 100)

Return Value

StrengthEffectAction

static StrengthEffectAction unsharpMask(int $strength = null)

Applies an unsharp mask filter to the image.

Parameters

Name Type Description
$strength int The strength of the filter. (Range: 1 to 2000, Server default: 100)

Return Value

StrengthEffectAction

static LevelEffectAction opacityThreshold(int $level = null)

Causes all semi-transparent pixels in an image to be either fully transparent or fully opaque.

Each pixel with an opacity lower than the specified threshold value is set to an opacity of 0%. Each pixel with an opacity greater than the specified threshold is set to an opacity of 100%. For example, setting opacity_threshold:0 makes all pixels non-transparent, while opacity_threshold:100 makes all semi-transparent pixels fully transparent. Note: This effect can be a useful solution when PhotoShop PSD files are delivered in a format supporting partial transparency, such as PNG, and the results without this effect are not as expected.

Parameters

Name Type Description
$level int The level of the threshold. (Range: 1 to 100, Server default: 50)

Return Value

LevelEffectAction

static Opacity opacity(float $level)

Adjusts the opacity of the image and makes it semi-transparent.

Parameters

Name Type Description
$level float The level of opacity. 100 means opaque, while 0 is completely transparent. (Range: 0 to 100)

Return Value

Opacity

See also

Opacity