Image styles convert long processing commands into friendly aliases to simplify instructions and facilitate management of multiple image operations. You can define multiple image operations (resize, crop, rotate, watermark, etc.) as an image style for images in a bucket.
Style Usage Rules
There are two ways to use image processing.
Adding image processing instruction code parameter to the image URL: You can append parameters to the image URL to apply processing. For details, see Image Processing Parameters.
Using image styles: It is recommended that you save different processing commands by creating styles, then apply them uniformly. Image styles are templates of real-time image processing parameters at the time of downloading.
Image Styles
Image style access URL format: Image Access URL + separator + style name
Image style: a template of combined real-time processing parameters.
Separator: a special symbol connecting the resource link and the image style.
When processing an access request, the storage service first locates the separator within the URL. It then attempts to match the content following the separator against existing image styles to trigger the corresponding image processing.
Style Separator
To avoid access errors, do not include any active delimiters in style names.
Use Example
1. To resize an image, set the following command code as the style content for the image style: image/resize,w_200.
2. Name this image style imageStyle and set the style delimiter to -.
3. The source image URL is: https://picture-style-example.jiangsu-10.zos.ctyun.cn/example.png.
4. The image URL with the processing command code added is https://picture-style-example.jiangsu-10.zos.ctyun.cn/example.png?x-zos-process=image/resize,w_200.
5. Combine the source image URL with the style name imageStyle using the style delimiter -. By accessing https://picture-style-example.jiangsu-10.zos.ctyun.cn/example.png-imageStyle, you can directly obtain the target image.
Usage Method
Usage Method | Reference Document |
Console | For details, see Image Styles. · Each bucket can create up to 100 styles, and styles apply only to images in that bucket. |