Updated on 2024-08-09 GMT+08:00

Creating an Image Style

Introduction

Each image style specifies a set of processing operations, including cropping, compression, and adding watermarks. For multiple images that require the same processing operations in a bucket, you can create an image style to apply it to the images.

When creating a style, you can preview the style effect of the sample image on the right in real time.

When using REST APIs to access image processing, you can call the style name in the URL to avoid entering complex commands. For details about the domain name rules for API access, see Access with a Style Name.

You can create up to 100 styles for a bucket.

You can also replicate existing image processing styles from another bucket.

Procedure for Creating an Image Style

  1. On the console homepage, click Service List in the upper left corner and choose Storage > Object Storage Service.
  2. Click a desired bucket name. In the navigation pane, choose Data Processing > Image Processing.

    Figure 1 Image processing

  3. Click Create to go to the style editing page shown in Figure 2.

    Figure 2 Creating a style

  4. On the editing page, specify a style name and configure properties:

    • Style Name

      Enter an easy-to-remember style name. Only letters (uppercase or lowercase), digits, periods (.), underscores (_), and hyphens (-) are allowed. The style name contains 1 to 256 characters, for example, rotate_0001.

    • Edit Mode

      Choose either GUI or Code to create an image style by configuring parameters or by editing code.

      An example code is as follows:

      image/sharpen,100/blur,r_1,s_1/resize,m_lfit,h_400,w_400,limit_1
    • Other settings

      Configure the image effect, resizing, watermark, and output.

  5. Click OK to save the style. The new style will be displayed in the style list.

Procedure for Replicating Image Styles

  1. On the console homepage, click Service List in the upper left corner and choose Storage > Object Storage Service.
  2. Click a desired bucket name. In the navigation pane, choose Data Processing > Image Processing.
  3. Click Replicate.
  4. Select a replication source, which is the source bucket where the required image styles were configured.

    • The image styles replicated from a source bucket will not overwrite existing styles in the current bucket, and any that conflict with the existing ones will not be replicated.
    • The version of both the source and destination buckets must be 3.0.
    • You can remove the styles that you do not want to replicate.
    Figure 3 Replicating image styles

  5. Click OK to replicate the image styles to the current bucket.