This document describes how to use COS Image Processing in the console, with the following two methods available for you. For more information on image processing, see Image Processing Overview.
Note:
- Image Processing is available only in public cloud regions.
- Image Processing is charged by CI. For detailed pricing, see Basic image processing fee in Billing and Pricing.
Note:To process an image, you need the write permission on objects. For object permissions setting, see Setting Object Access Permission.
Object URL?processing API name/processing operation name/processing parameter
Note:If the access permission on the image file is private-read, you need to add image processing parameters to the signed address.
Example: scaling an image to 50% of its original size
Suppose that the original image is displayed as below, the access permissions on the object are public read and private write, and the object URL is https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg
.
Next, add the following parameters to the URL:
Now, you obtain a new URL with added parameters https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg?imageMogr2/thumbnail/!50p
. Paste this URL to your address bar, press Enter, and you will see a scaled image as shown below:
Image Style can help you present different processing parameters in the format of template to standardize your image processing. The style created is an assembled template designed to process parameters in real time when an image is downloaded. Now, let’s take Image Style: width: 480px, height: 270px as an example, and introduce how to use this feature:
-
, _
, /
, and !
. Select !
here and save.Note:
- Note that style names are case-sensitive and cannot be modified once saved.
- For the purpose of clarity, the separator you have enabled cannot appear in the style name.
Note:
- Up to 100 styles can be set for a single bucket.
- The settings take effect in 30 minutes on average.
- Changing a separator requires clearing the cache. It takes at least 24 hours for separator changes to take effect globally.
- Canceling a separator used may cause product feature malfunctions.
- For more information on image styles, see Setting Styles.
Object URL + Separator + Processing style name
Now, you can obtain a final object URL https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg!yunstyle
. Paste it to your address bar, press Enter, and you will see a scaled image shown as below:
If you need to set a signature for the styled image, change the URL to https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/sample.jpeg!yunstyle?q-sign-algorithm=<signature>
, and use /sample.jpg!yunstyle
as the resource to calculate the signature <signature>
.
Was this page helpful?