class Quality extends BaseAction

Controls the quality of the delivered image or video.

Learn more: Image quality | Video quality

Methods

__construct($level, mixed ...$values)

Quality constructor.

addQualifier(BaseComponent $qualifier = null)

Adds the qualifier to the action.

addQualifiers(array ...$qualifiers)

Adds qualifiers to the action.

setGenericAction(string $action)

Adds (sets) generic (raw) action.

setFlag(FlagQualifier $flag, bool $set = true)

Sets the flag.

unsetFlag(FlagQualifier $flag)

Removes the flag.

importAction(BaseAction|null $action)

Imports (merges) qualifiers and flags from another action.

jsonSerialize()

Serializes to json.

__toString()

Serializes to Cloudinary URL format

level(int|string $level)

Sets the quality level.

auto($preset = null)

Quality auto.

autoGood()

Quality good.

autoBest()

Quality best.

autoEco()

Quality eco.

autoLow()

Quality low.

jpegmini(int $level = null)

Quality jpegmini.

jpegminiBest()

Quality jpegminiBest.

jpegminiHigh()

Quality jpegminiHigh.

jpegminiMedium()

Quality jpegminiMedium.

quality(int $level)

Controls the JPEG, WebP, GIF, JPEG XR and JPEG 2000 compression quality.

chromaSubSampling(string $chromaSubSampling)

Adds an optional qualifier to control chroma subsampling

quantization(int $quantization)

Controls the final quality by setting a maximum quantization percentage

anyFormat()

When used together with automatic quality (q_auto): allow switching to PNG8 encoding if the quality algorithm decides that it's more efficient.

Details

__construct($level, mixed ...$values)

Quality constructor.

Parameters

Name Type Description
$level
...$values mixed

$this addQualifier(BaseComponent $qualifier = null)

Adds the qualifier to the action.

Parameters

Name Type Description
$qualifier BaseComponent The qualifier to add.

Return Value

$this

$this addQualifiers(array ...$qualifiers)

Adds qualifiers to the action.

Parameters

Name Type Description
...$qualifiers array The qualifiers to add.

Return Value

$this

BaseAction setGenericAction(string $action)

Adds (sets) generic (raw) action.

Parameters

Name Type Description
$action string The generic action string.

Return Value

BaseAction

$this setFlag(FlagQualifier $flag, bool $set = true)

Sets the flag.

Parameters

Name Type Description
$flag FlagQualifier The flag to set.
$set bool Indicates whether to set(true) or unset(false) the flag instead. (Used for avoiding if conditions all over the code)

Return Value

$this

$this unsetFlag(FlagQualifier $flag)

Removes the flag.

Parameters

Name Type Description
$flag FlagQualifier The flag to unset.

Return Value

$this

$this importAction(BaseAction|null $action)

Imports (merges) qualifiers and flags from another action.

Parameters

Name Type Description
$action BaseAction|null The action to import.

Return Value

$this

mixed jsonSerialize()

Serializes to json.

Return Value

mixed

string __toString()

Serializes to Cloudinary URL format

Return Value

string

static QualityTrait level(int|string $level)

Sets the quality level.

Parameters

Name Type Description
$level int|string The quality value. (Range 1 to 100)

Return Value

QualityTrait

static QualityTrait auto($preset = null)

Quality auto.

Parameters

Name Type Description
$preset

Return Value

QualityTrait

static QualityTrait autoGood()

Quality good.

Return Value

QualityTrait

static QualityTrait autoBest()

Quality best.

Return Value

QualityTrait

static QualityTrait autoEco()

Quality eco.

Return Value

QualityTrait

static QualityTrait autoLow()

Quality low.

Return Value

QualityTrait

static QualityTrait jpegmini(int $level = null)

Quality jpegmini.

Parameters

Name Type Description
$level int The quality level. Use the constants defined in the JpegMini class.

Return Value

QualityTrait

See also

JpegMini

static QualityTrait jpegminiBest()

Quality jpegminiBest.

Alias for jpegmini(JpegMini::BEST)

Return Value

QualityTrait

See also

JpegMini

static QualityTrait jpegminiHigh()

Quality jpegminiHigh.

Alias for jpegmini(JpegMini::HIGH)

Return Value

QualityTrait

See also

JpegMini

static QualityTrait jpegminiMedium()

Quality jpegminiMedium.

Alias for jpegmini(JpegMini::MEDIUM)

Return Value

QualityTrait

See also

JpegMini

QualityBuilderTrait quality(int $level)

Controls the JPEG, WebP, GIF, JPEG XR and JPEG 2000 compression quality.

Reducing the quality is a trade-off between visual quality and file size.

Parameters

Name Type Description
$level int The quality level. 1 is the lowest quality and 100 is the highest.

Return Value

QualityBuilderTrait

QualityBuilderTrait chromaSubSampling(string $chromaSubSampling)

Adds an optional qualifier to control chroma subsampling

Chroma sub-sampling is a method of encoding images by implementing less resolution for chroma information (colors) than for luma information (luminance), taking advantage of the human visual system's lower acuity for color differences than for luminance

Parameters

Name Type Description
$chromaSubSampling string Chroma sub-sampling value

Return Value

QualityBuilderTrait

QualityBuilderTrait quantization(int $quantization)

Controls the final quality by setting a maximum quantization percentage

Parameters

Name Type Description
$quantization int The quantization level. Is a % (1-100) setting.

Return Value

QualityBuilderTrait

See also

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

Quality anyFormat()

When used together with automatic quality (q_auto): allow switching to PNG8 encoding if the quality algorithm decides that it's more efficient.

Return Value

Quality

See also

Flag::anyFormat

Constants

MAIN_QUALIFIER