Turn on image processing

Last updated: 2020-03-25 15:56:39

PDF

Note

This article describes how to use the image processing capabilities of COS through the console. You can use the image processing feature in two ways. For instructions on image processing, see Overview of picture processing .

  • By adding parameters to the picture URL You can process the image by adding the appropriate parameters after the object address (URL) of the image.
  • Use picture styles You can save different processing effects by creating styles, and then use styles to deal with the picture uniformly. The style set here is a template for real-time processing parameters when the picture is downloaded.
  • The image processing function only supports the public cloud region of Mainland China, China.
  • The image processing function is a charge item, which is collected by data Vientiane. For detailed billing instructions, please see data Vientiane. Billing and pricing .

Add URL parameter

  1. Login Cloud Object Storage console .
  2. Find the Bucket where the picture is located, click its storage name, and go to the Bucket management page.
  3. Under the operation bar on the right side of the picture file, click "details" to enter the file details page.
  4. Copy [object address] and paste it into the browser window address bar.

To deal with pictures, you need to write Permission with objects. For more information about the settings of object Permission, please see Setting Object Access Permission .
5. In the address bar, add the appropriate parameters after the object address in the following format. For more image processing parameters and instructions, see Basic picture processing of data Vientiane API Documentation.

Object address? Processing interface name / processing operation name / processing parameters.

If Access Permission of the picture file is privately read, you need to add image processing parameters to the signed address.

Example: zoom the width and height of the picture to 50% of the original image
Assuming that the effect of the original image is as follows, Access and Permission of the object are public read and private write, and the object address URL is https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg .
Img

Then add the following parameters to the URL link:

  • Zoom processing interface: imageMogr2
  • Zoom operation name: thumbnail
  • Processing parameters:! 50p

The address after adding the parameter is: https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg?imageMogr2/thumbnail/!50p Paste this address into the address bar and enter, and you can see the zoomed effect as follows.

Use picture styles

The picture style function can help you to present different processing operation parameters in the form of a template and uniformly process the picture through the style. The style set here is a template that is combined for real-time processing parameters when the picture is downloaded. The following is to Set the style that limits the picture to 480px wide and high 270px As an example, describe how to:

  1. Login Cloud Object Storage console .
  2. Find the Bucket where the picture is located, click its storage name, and go to the Bucket management page.
  3. In the left menu bar, click "Image processing" to enter Style management page.
    Separator The style delimiter is the symbol that separates the file name and the processing style, including an underscore (-), an underscore (_), a slash (/), and an exclamation point (!). Select the exclamation point (!) here and save it.
  4. Click [add style] to enter New style Page, the configuration information is as follows:
    • Style Nam Enter a custom style name, as an example here: yunstyle.
  • The style name needs to be case-sensitive and cannot be modified after saving.
  • To avoid ambiguity, the currently enabled interval marker must not appear in the processing style name.
    • Edit mode Select a basic editor.
  • Thumbnail mode: select zoom only.
  • Zoom selection: select to limit the width and height scale.
  • Thumbnail size: 480px wide, high 270px.
  • Progressive display: if turned on, Access pictures are displayed in a progressive way. Saving here is not enabled by default.
  • Output format: optional image output format, which keeps the default original image here.
  1. After the configuration information is complete, you can click the preview button on the right to view the preview effect.
  2. After the preview is correct, click "Save", and you can see that a picture style named yunstyle has been added.
  • A maximum of 100 styles can be set under the same Bucket.
  • The average effective time is 30 minutes.
  • To change the delimiter, you need to clear the cache. It takes at least 24 hours for entire network to take effect.
  • Canceling the used delimiter may result in Features exception.
  • For more information about picture styles, see Style settin .
    1. Go to the object details page, copy the object address and add a delimiter and style name after the object address in the following format.
Object address + delimiter + processing style name

The final object address is: https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg!yunstyle Paste this address into the address bar and enter, and you can see the zoomed effect as follows.