Updated on 2023-12-22 GMT+08:00

Creating Image Styles

Context

By creating image styles, you can process the image such as cropping, compressing, and watermarking. Each image style specifies a set of process operations. For images require the same process operations, you can create an image style to batch process them. Once a style is successfully created, it can be used by multiple images in the bucket.

When creating styles, you can view the style effects of the sample image on the right.

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 Style Access Method.

You can create a maximum of 100 styles for one bucket at one time.

You can create image processing styles or replicate existing image processing styles from another bucket.

Creating an Image Processing 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. The style editing page is displayed. For details, see Figure 2.

    Figure 2 Creating a style

  4. On the editing page, you can edit the style name and basic properties. You can also set the resize mode, as well as perform operations like rotation/cropping, watermarking, and image output.

    • Style Name

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

    • Edit Mode

      You can either choose GUI mode for visible editing, or choose Code mode.

      An example code is as follows:

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

      You can set image effects, resizing, watermarks, and output parameter values.

  5. After finishing editing the image style, click OK to save the style. The new style will be displayed in the style list.

Replicating Image Processing 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, that is, the source bucket for which the image processing styles were configured.

    • The image processing styles replicated from a source bucket will not overwrite existing styles in the destination 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 processing styles

  5. Click OK to replicate the image processing styles to the destination bucket.