Transformation
class Transformation extends CommonTransformation
Defines how to manipulate and transform images.
Learn more: Image transformations
Methods
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
Custom resize builder.
Applies delivery action.
Deliver the image in the specified device pixel ratio.
Delivers the image as an attachment.
Adds ICC color space metadata to the image, even when the original image doesn't contain any ICC data.
Instructs Cloudinary to clear all image meta-data (IPTC, Exif and XMP) while applying an incoming transformation.
Returns metadata of the input asset and of the transformed output asset in JSON instead of the transformed image.
Sets the cache-control to immutable for the asset.
Keeps the copyright related fields when stripping meta-data.
Keeps all meta-data.
Instructs Cloudinary to clear all ICC color profile data included with the image.
Inject a custom function into the image transformation pipeline.
Applies a filter or an effect on an asset.
Applies adjustment effect on an asset.
Applies a pre-defined named transformation of the given name.
Adds a generic qualifier as a separate action.
Adds action defined as an array of qualifiers.
Adds a flag as a separate action.
Rotates the asset by the given angle.
Specifies a conditional transformation whose condition should be met before applying a transformation.
Instruct Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
Sets the delay between frames of an animated image in milliseconds.
Default images can be used in the case that a requested image does not exist.
Controls the density to use when delivering an image or when converting a vector file such as a PDF or EPS document to a web image delivery format.
Prevents style class names collisions for sprite generation.
Extracts selected pages/frames from the asset.
Extracts selected layers/embedded objects from the PSD file.
Adds another video, text, image as an overlay over the container video.
Changes the shape of the image.
Rounds the corners of a video.
Don't stream a video that is currently being generated on the fly. Wait until the video is fully generated.
Causes the video download to begin immediately, streaming it as a fragmented video file.
Deliver an HLS adaptive bitrate streaming file as HLS v3 instead of the default version (HLS v4).
Keep the Display Aspect Ratio metadata of the uploaded video.
Convert the audio channel to mono.
Truncate (trim) a video file based on the start time defined in the metadata.
Create a waveform image (in the format specified by the file extension) from the audio or video file.
Trims a video (and discards the rest).
Applies the video as a cutter for the main video.
Adds subtitles to the video.
Transcodes the video (or audio) to another format / adjusts encoding properties.
Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected fps level (helps with sync to audio).
Explicitly sets the keyframe interval of the delivered video.
Controls the video bitrate.
Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.
Sets the total number of frames to sample from the original video.
Applies the specified video edit action.
Details
TransformationResizeTrait
resize(BaseResizeAction $resize)
Resize the asset using provided resize action
TransformationResizeTrait
scale(int|float|string|null $width = null, int|float|null $height = null, int|float|array $aspectRatio = null)
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
TransformationResizeTrait
crop(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)
Extracts a region of the given width and height out of the original image.
TransformationResizeTrait
fill(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null)
Creates an image with the exact given width and height without distorting the image.
This option first scales up or down as much as needed to at least fill both of the given dimensions. If the requested aspect ratio is different than the original, cropping will occur on the dimension that exceeds the requested size after scaling.
TransformationResizeTrait
genericResize(string $name, int|float|string|null $width = null, int|float|null $height = null)
Custom resize builder.
TransformationDeliveryTrait
delivery(mixed $delivery)
Applies delivery action.
TransformationDeliveryTrait
format(Format|string $format)
Forces format conversion to the given format.
(Formerly known as fetch format)
TransformationDeliveryTrait
quality(int|string|Quality $quality)
Controls compression quality. 1 is the lowest quality and 100 is the highest.
Reducing the quality is a trade-off between visual quality and file size.
TransformationDeliveryTrait
dpr(float|string $dpr)
Deliver the image in the specified device pixel ratio.
CommonTransformationFlagTrait
attachment(string $filename = null)
Delivers the image as an attachment.
CommonTransformationFlagTrait
forceIcc()
Adds ICC color space metadata to the image, even when the original image doesn't contain any ICC data.
CommonTransformationFlagTrait
forceStrip()
Instructs Cloudinary to clear all image meta-data (IPTC, Exif and XMP) while applying an incoming transformation.
CommonTransformationFlagTrait
getInfo()
Returns metadata of the input asset and of the transformed output asset in JSON instead of the transformed image.
CommonTransformationFlagTrait
immutableCache()
Sets the cache-control to immutable for the asset.
CommonTransformationFlagTrait
keepAttribution()
Keeps the copyright related fields when stripping meta-data.
CommonTransformationFlagTrait
keepIptc()
Keeps all meta-data.
CommonTransformationFlagTrait
stripProfile()
Instructs Cloudinary to clear all ICC color profile data included with the image.
TransformationCustomFunctionTrait
customFunction(CustomFunction $customFunction)
Inject a custom function into the image transformation pipeline.
CommonTransformationTrait
effect(EffectQualifier|EffectAction $effect)
Applies a filter or an effect on an asset.
CommonTransformationTrait
adjust(EffectQualifier|EffectAction|AdjustmentInterface $adjustment)
Applies adjustment effect on an asset.
CommonTransformationTrait
namedTransformation(string|NamedTransformation $transformationName)
Applies a pre-defined named transformation of the given name.
CommonTransformationTrait
addGenericQualifier(string $shortName, array|mixed ...$value)
Adds a generic qualifier as a separate action.
CommonTransformationTrait
addActionFromQualifiers(array $qualifiers)
Adds action defined as an array of qualifiers.
CommonTransformationTrait
addFlag(FlagQualifier|string $flag)
Adds a flag as a separate action.
CommonTransformationTrait
addVariable(string|Variable $name, mixed $value = null)
Defines an new user variable.
CommonTransformationTrait
rotate(string|int $angle)
Rotates the asset by the given angle.
CommonTransformationTrait
conditional(Conditional $conditionalTransformation)
Specifies a conditional transformation whose condition should be met before applying a transformation.
ImageTransformationFlagTrait
sanitize()
Instruct Cloudinary to run a sanitizer on the image (relevant only for the SVG format).
ImageQualifierTransformationTrait
delay(Delay|int $delay)
Sets the delay between frames of an animated image in milliseconds.
$this
defaultImage(string $defaultImage)
Default images can be used in the case that a requested image does not exist.
Density
density(int|string $density)
Controls the density to use when delivering an image or when converting a vector file such as a PDF or EPS document to a web image delivery format.
Prefix
prefix(string $prefix)
Prevents style class names collisions for sprite generation.
LayeredImageTransformationTrait
extract(PageQualifier|string|int ...$pages)
Extracts selected pages/frames from the asset.
LayeredImageTransformationTrait
psdTools(PageQualifier|string|int ...$pages)
Extracts selected layers/embedded objects from the PSD file.
VideoSpecificTransformationTrait
overlay(BaseSource|string $videoLayer, BasePosition|null $position = null, Timeline|null $timeline = null)
Adds another video, text, image as an overlay over the container video.
ImageSpecificTransformationTrait
underlay(string $layer, Position|AbsolutePosition $position = null, string $blendMode = null)
Adds an underlay under the base image.
ImageSpecificTransformationTrait
reshape(ReshapeQualifier|EffectAction|EffectQualifier|mixed $reshape)
Changes the shape of the image.
VideoSpecificTransformationTrait
roundCorners(int|string $radius)
Rounds the corners of a video.
ImageSpecificTransformationTrait
border(Border $border)
Adds a border around the image.
ImageSpecificTransformationTrait
backgroundColor(Background|ColorValue|string $color)
Sets the color of the background.
ImageSpecificTransformationTrait
background(Background|string $background)
Sets the image background.
ImageSpecificTransformationTrait
colorSpace(ColorSpace|string $colorSpace)
Controls the color space used for the delivered image.
ImageSpecificTransformationTrait
animated(AnimatedEdit $animated)
Applies animated image transformation action.
VideoTransformationFlagTrait
noStream()
Don't stream a video that is currently being generated on the fly. Wait until the video is fully generated.
VideoTransformationFlagTrait
streamingAttachment(string $filename = null)
Causes the video download to begin immediately, streaming it as a fragmented video file.
VideoTransformationFlagTrait
hlsv3()
Deliver an HLS adaptive bitrate streaming file as HLS v3 instead of the default version (HLS v4).
VideoTransformationFlagTrait
keepDar()
Keep the Display Aspect Ratio metadata of the uploaded video.
VideoTransformationFlagTrait
mono()
Convert the audio channel to mono.
VideoTransformationFlagTrait
truncateTS()
Truncate (trim) a video file based on the start time defined in the metadata.
VideoTransformationFlagTrait
waveform()
Create a waveform image (in the format specified by the file extension) from the audio or video file.
VideoSpecificTransformationTrait
trim(Timeline $range)
Trims a video (and discards the rest).
VideoSpecificTransformationTrait
concatenate(VideoSource|string $videoSource)
Concatenates another video or image.
VideoSpecificTransformationTrait
cutter(VideoSource|string $videoLayer, BasePosition|null $position = null, Timeline|null $timeline = null)
Applies the video as a cutter for the main video.
VideoSpecificTransformationTrait
addSubtitles(string $subtitlesId)
Adds subtitles to the video.
VideoSpecificTransformationTrait
transcode(AudioCodec|VideoCodec|AudioFrequency|mixed $transcode)
Transcodes the video (or audio) to another format / adjusts encoding properties.
VideoSpecificTransformationTrait
fps(float|int|string $min, float|int|string|null $max = null)
Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected fps level (helps with sync to audio).
VideoSpecificTransformationTrait
keyframeInterval(float $interval)
Explicitly sets the keyframe interval of the delivered video.
VideoSpecificTransformationTrait
bitRate(int|string $bitRate, string $type = null)
Controls the video bitrate.
VideoSpecificTransformationTrait
streamingProfile(string $streamingProfile)
Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.
The value can be one of the pre-defined streaming profiles or a custom-defined one. You can use the streaming profiles methods of StreamingProfilesTrait to get a list of the available streaming profiles or to create new custom profiles.
VideoSpecificTransformationTrait
videoSampling(int|string $value)
Sets the total number of frames to sample from the original video.
Relevant when converting videos to animated GIF or WebP format. If not specified, the resulting GIF or WebP samples the whole video (up to 400 frames, at up to 10 frames per second). By default the duration of the animated image is the same as the duration of the video, no matter how many frames are sampled from the original video (use the delay qualifier to adjust the amount of time between frames).
VideoSpecificTransformationTrait
videoEdit(mixed $videoEdit)
Applies the specified video edit action.