The quality adjustment operation uses the format of a source image to compress the image. You can use the quality adjustment parameters to modify the quality of source images stored in Object Storage Service (OSS). This topic describes the parameters and examples for image quality adjustment.

Quality adjustment applies only to JPG and WebP images.

Parameters

Operation name: quality

The following table describes the parameters that you can configure when you adjust the quality of an image.

Parameter Description Valid value
q Specifies the relative quality of the image and compresses the source image based on percentage.

If the source image quality is 100%, you can obtain an image whose quality value is 90% after you add the quality,q_90 parameter. If the quality value of the source image is 80%, you can obtain an image whose quality value is 72% after you add the quality,q_90 parameter.

Note The q parameter applies only to source images in the JPG format to specify the relative quality of the images. If a source image is in the WebP format, this parameter works the same as Q. The absolute quality is specified for the image.
[1,100]
Q Specifies the absolute quality of the image and compresses the source image based on Q%. If the quality value of the source image is smaller than the specified Q value, the quality value of the compressed image is the quality value of the source image.

For example, if the quality value of the source image is 95%, you can obtain an image that has a quality value of 90% after you add quality,Q_90. If the quality value of the source image is 80%, you can obtain an image that has a quality value of 80% after you add quality,Q_90.

Note The Q parameter applies only to JPG and WebP images.
[1,100]

Examples

You can process images by using object URLs, OSS SDKs, or API operations. In this example, object URLs are used. For more information about how to use OSS SDKs and API operations to process images, see IMG implementation modes.

An image in the bucket named oss-console-img-demo-cn-hangzhou in the China (Hangzhou) region is used in the following examples. The following URL is used to access the image over the Internet: