abstract class Effect

Defines effects that you can apply to transform your assets.

Learn more: Image effects | Video effects

Methods

blur(int $strength = null)

Applies a blurring filter to the asset.

vignette(int $strength = null)

Applies a vignette effect.

blackWhite(int $threshold = null)

Converts the image to black and white.

colorize(int $level = null, string $color = null)

Colorizes the image.

grayscale()

Converts the image to gray-scale (multiple shades of gray).

negate()

Negates the image colors (negative).

sepia(int $level = null)

Changes the color scheme of the image to sepia.

assistColorBlind(int $strength = null)

Applies stripes to the image to help people with common color-blind conditions to differentiate between colors that are similar for them.

simulateColorBlind(string $condition = null)

Simulates the way an image would appear to someone with the specified color blind condition.

pixelate(int $squareSize = null)

Applies a pixelation effect to the image.

makeTransparent(int $tolerance = null)

Makes the background of the image transparent (or solid white for formats that do not support transparency).

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

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

dither(int $level = null)

Applies an ordered dither filter to the image.

gradientFade(int $strength = null, string $type = null)

Applies a gradient fade effect from the top edge of the image.

cutOut(string|Media $source = null)

Trims pixels according to the transparency levels of a specified overlay image.

artisticFilter(string $filter)

Applies the selected artistic filter to the image.

cartoonify(float $lineStrength = null, float|string $colorReduction = null)

Applies a cartoon effect to an image.

styleTransfer(string $source, int $strength = null, bool $preserveColor = null)

Transfers the style of a source artwork to a target photograph using the Neural Artwork Style Transfer add-on.

oilPaint(int $strength = null)

Applies an oil painting effect to the image.

redEye()

Removes red eyes in the image.

advancedRedEye()

Removes red eyes with the Advanced Facial Attribute Detection add-on.

vectorize(int $colors = null, float $detail = null, float $despeckle = null, int $corners = null, int $paths = null)

Vectorizes the image.

outline(string $mode = null, int $width = null, int $blurLevel = null)

Adds an outline to a transparent image.

shadow(int $strength = null, PointValue $position = null, string $color = null)

Adds a shadow to the image.

lightroom()

Applies Adobe Lightroom filter.

deshake(int $shakeStrength = null)

Removes small motion shifts from the video. with a maximum extent of movement in the horizontal and vertical direction of 32 pixels

fadeIn(int $duration = null)

Fade in at the beginning of the video.

fadeOut(int $duration = null)

Fade out at the end of the video.

noise(int $percentage = null)

Adds visual noise to the video, visible as a random flicker of "dots" or "snow".

accelerate(int $rate = null)

Changes the speed of the video playback.

boomerang()

Causes a video clip to play forwards and then backwards.

loop(int $additionalIterations = null)

Delivers a video that contains additional loops of the video.

reverse()

Plays the video or audio file in reverse.

volume(int|Volume $level)

Increases or decreases the volume by a percentage of the current volume.

transition()

Indicates that the video overlay is to be used as a transition between the base and second video.

generic(string $name, mixed ...$args)

A user defined generic effect.

fromParams(string|array $qualifiers)

Creates effect from an array of qualifiers.

Details

static Blur blur(int $strength = null)

Applies a blurring filter to the asset.

Parameters

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

Return Value

Blur

static StrengthEffectAction vignette(int $strength = null)

Applies a vignette effect.

Parameters

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

Return Value

StrengthEffectAction

static ThresholdEffectAction blackWhite(int $threshold = null)

Converts the image to black and white.

Parameters

Name Type Description
$threshold int The balance between black (100) and white (0). (Range: 0 to 100, Server default: 50)

Return Value

ThresholdEffectAction

static Colorize colorize(int $level = null, string $color = null)

Colorizes the image.

Parameters

Name Type Description
$level int The strength of the color. (Range: 0 to 100, Server default: 100)
$color string The color to use for colorization. Specify HTML name or RGB hex code. (Server default: gray)

Return Value

Colorize

static EffectAction grayscale()

Converts the image to gray-scale (multiple shades of gray).

Return Value

EffectAction

static EffectAction negate()

Negates the image colors (negative).

Return Value

EffectAction

static LevelEffectAction sepia(int $level = null)

Changes the color scheme of the image to sepia.

Parameters

Name Type Description
$level int The level of sepia to apply. (Range: 1 to 100, Server default: 80)

Return Value

LevelEffectAction

static AssistColorBlind assistColorBlind(int $strength = null)

Applies stripes to the image to help people with common color-blind conditions to differentiate between colors that are similar for them.

You can replace colors using the xRay() method of the \Cloudinary\Transformation\AssistColorBlind class.

Parameters

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

Return Value

AssistColorBlind

See also

AssistColorBlind

static SimulateColorBlind simulateColorBlind(string $condition = null)

Simulates the way an image would appear to someone with the specified color blind condition.

For a list of supported color blind conditions see the \Cloudinary\Transformation\SimulateColorBlind class.

Parameters

Name Type Description
$condition string The color blind condition. Use the constants defined in the SimulateColorBlind class.

Return Value

SimulateColorBlind

See also

SimulateColorBlind

static Pixelate pixelate(int $squareSize = null)

Applies a pixelation effect to the image.

Parameters

Name Type Description
$squareSize int The width of each pixelation square in pixels. (Range: 1 to 200, Server default: 5)

Return Value

Pixelate

static MakeTransparent makeTransparent(int $tolerance = null)

Makes the background of the image transparent (or solid white for formats that do not support transparency).

The background is determined as all pixels that resemble the pixels on the edges of the image.

Parameters

Name Type Description
$tolerance int The tolerance used to accommodate variance in the background color. (Range: 0 to 100, Server default: 10)

Return Value

MakeTransparent

static RemoveBackground removeBackground(bool $screen = false, string|Color $colorToRemove = null)

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

Use when the background is a uniform color.

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.

Return Value

RemoveBackground

See also

RemoveBackground

static Dither dither(int $level = null)

Applies an ordered dither filter to the image.

Use the constants defined in \Cloudinary\Transformation\OrderedDither for $level.

Parameters

Name Type Description
$level int The level of ordered dither. Use the constants defined in the OrderedDither class.

Return Value

Dither

See also

Dither

static GradientFade gradientFade(int $strength = null, string $type = null)

Applies a gradient fade effect from the top edge of the image.

You can specify other edges using the x and y methods of the \Cloudinary\Transformation\GradientFade class.

Parameters

Name Type Description
$strength int The strength of the fade effect. (Range: 0 to 100, Server default: 20)
$type string The type of gradient fade: GradientFade::SYMMETRIC or GradientFade::SYMMETRIC_PAD.

Return Value

GradientFade

See also

GradientFade

static CutOut cutOut(string|Media $source = null)

Trims pixels according to the transparency levels of a specified overlay image.

Wherever an overlay image is transparent, the original is shown, and wherever an overlay is opaque, the resulting image is transparent.

Parameters

Name Type Description
$source string|Media The public ID of the source.

Return Value

CutOut

See also

CutOut

static mixed artisticFilter(string $filter)

Applies the selected artistic filter to the image.

See the Image Transformations guide for examples of each of the filters.

Parameters

Name Type Description
$filter string The filter to apply. Use the constants defined in the ArtisticFilter class.

Return Value

mixed

See also

ArtisticFilter
https://cloudinary.com/documentation/image_transformations#available_filters

static Cartoonify cartoonify(float $lineStrength = null, float|string $colorReduction = null)

Applies a cartoon effect to an image.

Parameters

Name Type Description
$lineStrength float The thickness of the lines. (Range: 0 to 100, Server default: 50)
$colorReduction float|string The decrease in the number of colors and corresponding saturation boost of the remaining colors. (Range: 0 to 100, Server default: automatically adjusts according to the line_strength value). Higher reduction values result in a less realistic look. Set $colorReduction to Cartoonify::BLACK_WHITE for a black and white cartoon effect.

Return Value

Cartoonify

See also

Cartoonify

static EffectAction styleTransfer(string $source, int $strength = null, bool $preserveColor = null)

Transfers the style of a source artwork to a target photograph using the Neural Artwork Style Transfer add-on.

For details, see the Neural Artwork Style Transfer add-on documentation.

Parameters

Name Type Description
$source string The public ID of the source artwork.
$strength int The strength of the style transfer. Higher numbers result in an output that is more highly influenced by the source artwork style. (Range: 0 to 100, Server default: 100)
$preserveColor bool When true, style elements of the source artwork, such as brush style and texture, are transferred to the target photo, but the prominent colors from the source artwork are not transferred, so the result retains the original colors of the target photo.

Return Value

EffectAction

See also

https://cloudinary.com/documentation/neural_artwork_style_transfer_addon

static StrengthEffectAction oilPaint(int $strength = null)

Applies an oil painting effect to the image.

Parameters

Name Type Description
$strength int The strength of the effect. (Range: 0 to 100, Server default: 30)

Return Value

StrengthEffectAction

static EffectAction redEye()

Removes red eyes in the image.

Return Value

EffectAction

static EffectAction advancedRedEye()

Removes red eyes with the Advanced Facial Attribute Detection add-on.

For details, see the Advanced Facial Attribute Detection add-on documentation.

static Vectorize vectorize(int $colors = null, float $detail = null, float $despeckle = null, int $corners = null, int $paths = null)

Vectorizes the image.

Use the methods in \Cloudinary\Transformation\Vectorize to control different aspects of the vectorize effect.

Notes: * To deliver the image as a vector image, make sure to change the format (or URL extension) to a vector format, such as SVG. However, you can also deliver in a raster format if you just want to get the 'vectorized' graphic effect. * Large images are scaled down to 1000 pixels in the largest dimension before vectorization.

Parameters

Name Type Description
$colors int The number of colors. (Range: 2 to 30, Server default: 10)
$detail float The level of detail. Specify either a percentage of the original image (Range: 0.0 to 1.0) or an absolute number of pixels (Range: 0 to 1000). (Server default: 300)
$despeckle float The size of speckles to suppress. Specify either a percentage of the original image (Range: 0.0 to 1.0) or an absolute number of pixels (Range: 0 to 100, Server default: 2)
$corners int The corner threshold. Specify 100 for no smoothing (polygon corners), 0 for completely smooth corners. (Range: 0 to 100, Default: 25)
$paths int The optimization value. Specify 100 for least optimization and the largest file. (Range: 0 to 100, Server default: 100).

Return Value

Vectorize

See also

Vectorize

static Outline outline(string $mode = null, int $width = null, int $blurLevel = null)

Adds an outline to a transparent image.

For examples, see the Image Transformations guide.

Parameters

Name Type Description
$mode string The type of outline effect. Use the constants defined in the Outline class. (Default: OutlineMode::INNER and OutlineMode::OUTER).
$width int The thickness of the outline in pixels. (Range: 1 to 100, Server default: 5)
$blurLevel int The level of blur of the outline. (Range: 0 to 2000, Server default: 0)

Return Value

Outline

See also

Outline
OutlineMode
https://cloudinary.com/documentation/image_transformations#outline_effects

static Shadow shadow(int $strength = null, PointValue $position = null, string $color = null)

Adds a shadow to the image.

The shadow is offset by the x and y values specified in the $position qualifier.

Parameters

Name Type Description
$strength int The strength of the shadow. (Range: 0 to 100, Server default: 40)
$position PointValue The position of the shadow. (Server default: bottom right)
$color string The color of the shadow (Server default: gray)

Return Value

Shadow

See also

Shadow

static LightroomEffect lightroom()

Applies Adobe Lightroom filter.

Return Value

LightroomEffect

static Deshake deshake(int $shakeStrength = null)

Removes small motion shifts from the video. with a maximum extent of movement in the horizontal and vertical direction of 32 pixels

Parameters

Name Type Description
$shakeStrength int The maximum number of pixels in the horizontal and vertical direction that will be addressed. (Possible values: 16, 32, 48, 64. Server default: 16)

Return Value

Deshake

static DurationEffectAction fadeIn(int $duration = null)

Fade in at the beginning of the video.

For details and examples, see 'Fade in and out' in the Video Transformations guide.

Parameters

Name Type Description
$duration int The time in ms for the fade to occur. (Server default: 1000)

Return Value

DurationEffectAction

See also

https://cloudinary.com/documentation/video_manipulation_and_delivery#fade_in_and_out

static DurationEffectAction fadeOut(int $duration = null)

Fade out at the end of the video.

For details and examples, see 'Fade in and out' in the Video Transformations guide.

Parameters

Name Type Description
$duration int The time in ms for the fade to occur.

Return Value

DurationEffectAction

See also

https://cloudinary.com/documentation/video_manipulation_and_delivery#fade_in_and_out

static EffectAction noise(int $percentage = null)

Adds visual noise to the video, visible as a random flicker of "dots" or "snow".

Parameters

Name Type Description
$percentage int The percent of noise to apply. (Range: 0 to 100 Server default: 0)

Return Value

EffectAction

static Accelerate accelerate(int $rate = null)

Changes the speed of the video playback.

Parameters

Name Type Description
$rate int The percentage change of speed. Positive numbers speed up the playback, negative numbers slow down the playback (Range: -50 to 100, Server default: 0).

Return Value

Accelerate

static EffectAction boomerang()

Causes a video clip to play forwards and then backwards.

Use in conjunction with trimming qualifiers ('duration', 'start_offset', or 'end_offset') and the 'loop' effect to deliver a classic (short, repeating) boomerang clip. For details and examples, see 'Create a boomerang video clip' in the Video Transformations guide.

static Loop loop(int $additionalIterations = null)

Delivers a video that contains additional loops of the video.

The total number of iterations is the number of additional loops plus one.

For animated images (GIF), see Animated::edit()->loop().

Parameters

Name Type Description
$additionalIterations int The additional number of times to play the video.

Return Value

Loop

static EffectAction reverse()

Plays the video or audio file in reverse.

Return Value

EffectAction

static EffectAction volume(int|Volume $level)

Increases or decreases the volume by a percentage of the current volume.

Also see \Cloudinary\Transformation\Volume for different ways to change the volume.

Parameters

Name Type Description
$level int|Volume The percentage change of volume (Range: -100 to 400).

Return Value

EffectAction

See also

Volume

static EffectAction transition()

Indicates that the video overlay is to be used as a transition between the base and second video.

Return Value

EffectAction

static EffectAction generic(string $name, mixed ...$args)

A user defined generic effect.

Parameters

Name Type Description
$name string The effect name.
...$args mixed Optional effect arguments.

Return Value

EffectAction

static EffectAction fromParams(string|array $qualifiers)

Creates effect from an array of qualifiers.

Parameters

Name Type Description
$qualifiers string|array The effect qualifiers.

Return Value

EffectAction