Processing Images
This section describes the URL constitution to process images using REST APIs. Once you have enabled OBS successfully, you can call REST APIs to process images simply by putting a URL that complies with the command rules of image processing in a browser.
URL Constitution
A URL consists of the OBS domain name, bucket name, the original image name, and processing command or style name.
Command Access Method
URL format: https://bucketName.endpoint/objectName?x-image-process=image/commands
- endpoint is the endpoint address of the region where the bucket resides. You can obtain the endpoint address from the bucket's basic information. For details about OBS regions and endpoints, see Regions and Endpoints.
- bucketName is the name of the bucket that accommodates the image to be processed on OBS.
- objectName is the name of the original image stored in the bucketName bucket on OBS. The suffix of the image name must be supported by image processing.
- commands are the processing commands. Three types of delimiters are used between commands or command parameters. See Delimiters. If no commands are entered, the original image will be returned.
Example: https://image-demo.obs.region.example.com/example.jpg?x-image-process=image/crop,x_100,y_50
Delimiters are separation identifiers used in URLs to distinguish one field from another in the command. For details, see Table 1.
Name |
Character |
Sequence |
Description |
---|---|---|---|
Parameter delimiter |
_ |
Fixed |
Delimiter between the command parameter and its value. |
Command delimiter |
, |
Irrelevant |
Delimiter between multiple command parameters. |
Pipe delimiter |
/ |
Relevant |
Delimiter between two processing commands. See Pipes. |
If an image is to be processed by multiple operations, such as cropping and resizing, the operation commands need to be connected to each other by the pipe delimiter "/". The processing operations are executed from left to right according to the designated sequence of pipes.
For example, https://image-demo.obs.region.example.com/example.jpg?x-image-process=image/resize,w_100,h_100/quality,q_80 has two pipes. The pipes will be executed from left to right in sequence and the command output of the previous pipe will be used as the input of the next pipe.
Style Access Method
URL format: https://bucketName.endpoint/objectName?x-image-process=style/stylename.
- endpoint is the endpoint address of the region where the bucket resides. You can obtain the endpoint address from the bucket's basic information. For details about OBS regions and endpoints, see Regions and Endpoints.
- bucketName is the bucket name on OBS.
- objectName is the name of the original image stored in the bucketName bucket on OBS. The suffix of the image name must be supported by image processing.
- stylename is the style name that has been created in the bucketName bucket on OBS Console. Currently, you cannot perform other operations related to styles by calling REST APIs, such as creating, changing, and deleting styles.
Example: https://image-demo.obs.region.example.com/example.jpg?x-image-process=style/stylename
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot