You can add multiple processing parameters to a style to perform complex operations on media, documents, or images that are stored in an Object Storage Service (OSS) bucket.
You can use the data processing features of OSS in the regions supported by Intelligent Media Management (IMM) endpoints by calling API operations or using SDKs.
Use a custom style
Create a style
You can create up to 50 styles for a bucket. You can use the styles only for the objects stored in the bucket. If your business requires more styles, contact OSS technical support.
In the left-side navigation tree, click IMG, Document Processing, Media Processing, or other data processing features based on the type of the object that you want to process.
Click the Style Management tab and then click Create Style.
In the Create Style panel, configure the parameters to create a style.
Click OK.
Use a style
After you create a style for a bucket, you can use the style when you process objects in the bucket by using object URLs or asynchronous requests.
Use object URLs for synchronous processing
You can add the style to the URL of an object for synchronous processing. After you add the style, the object URL is in the http(s)://BucketName.Endpoint/ObjectName?x-oss-process=style/StyleName
format. The following table describes the parameters in the format.
Parameter | Description | Example |
| The URL of the object. For more information, see Using presigned URLs to download objects. | |
| Specifies that the object is processed by using style parameters. This parameter is a fixed parameter. | |
| The name of the style. |
You can also specify custom delimiters and map a custom domain name to the bucket to simplify the object URL. Example:
Use an exclamation point (
!
) to replacex-oss-process=style/
.Map a custom domain name to the bucket to further simplify the object URL. For more information, see Map a custom domain name to the default domain name of a bucket.
For example, if you map the custom domain name example.com
to the bucket, you can use https://example.com/example.jpg!small
to process the object.
Starting from 00:00:00 on October 9, 2022, you can no longer preview objects in a created bucket in the OSS console or by calling API operations. To use the online preview feature, you must map a custom domain name to a bucket. Otherwise, the online preview feature cannot be used. For more information, see Alibaba Cloud OSS Update - Response Header upgrade when objects stored in buckets are accessed.
Use a style for asynchronous processing
Below is the sample code for asynchronously processing an object using x-oss-async-process=style/StyleName:
POST /ObjectName?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Use the StyleName style to asynchronously process the example.avi object and save the processed object as oss://outbucket/outobjprefix.mp4.
x-oss-async-process=style/StyleName|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ
The following table describes the parameters in the preceding sample code.
Parameter | Description |
| The name of the object. |
| Specifies that the object is processed by using style parameters. This parameter is a fixed parameter. |
| The name of the style. |
Use built-in styles
In addition to custom styles, you can also use built-in styles for processing.
Use a style for asynchronous processing
Below is the sample code for asynchronously processing an object using x-oss-async-process=style/::systemStyleName:
POST /ObjectName?x-oss-async-process HTTP/1.1
Host: video-demo.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 28 Oct 2022 06:40:10 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
// Process example.avi asynchronously using the built-in style named h264-mp4-1080p, and save the processed object as oss://outbucket/outobjprefix.mp4.
x-oss-async-process=style/::h264-mp4-1080p|sys/saveas,b_b3V0YnVja2V0,o_b3V0b2JqcHJlZml4LnthdXRvZXh0fQ
The following table describes the parameters in the preceding sample code.
Parameter | Description |
| The name of the object. |
| Specifies that the object is processed by using style parameters. This parameter is a fixed parameter. |
| Specifies that a built-in style is used. |
| The name of the built-in style. Note You can view all built-in style parameters that are supported on the Data Processing>Media Processing page. |
Import styles from a source bucket to a destination bucket
Only image processing (IMG) allows you to import styles from a source bucket to a destination bucket.
You can import styles that are created in a source bucket to a destination bucket. This way, you can use the styles to process image objects in the destination bucket.
Export styles from the source bucket.
In the left-side navigation tree of the source bucket, choose Data Processing > IMG.
On the IMG page, click Export Style.
In the Save As dialog box, select the path to which you want to save the styles and click Save.
Import the styles to the destination bucket.
References
For information about how to use parameters to process objects, see Synchronous processing.
For information about how to store processed objects in OSS, see sys/saveas.