Processing Images

This section describes the URL constitution to process images using RESTful APIs. Once you have enabled OBS successfully, you can call RESTful APIs to process images simply by inputting a URL that complies with the command rules of Image Processing in the address box of the 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: http://domain/bucketName/objectName?x-image-process=image/commands.

  • domain is the domain name of OBS. 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 consistent with formats that are supported by Image Processing.
  • commands are the processing commands. Three types of delimiters are used between commands or command parameters. See Delimiters. For details about commands and parameters, see Management. If no commands are input, the original image will be returned.

For example: http://bucket-A.obs.cn-north-1.myhwclouds.com/sample.jpg?x-image-process=image/crop,x_100,y_50.

  • Delimiters

Delimiters are separation identifiers used in URLs to distinguish one field from another in the command. For details, see Table 1.

Table 1 Delimiter

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.

  • 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, http://bucket-A.obs.cn-north-1.myhwclouds.com/sample.jpg?x-image-process=image/resize,w_100,h_100/quality,q_80 are two pipes executed from left to right. The output of the left command becomes the input of the right command.

Style Access Method

URL format: http://domain/bucketName/objectName?x-image-process=style/stylename.

  • domain is the domain name of OBS.
  • 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 consistent with formats that are 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 RESTful APIs, such as creating, changing, and deleting styles.

For example: http://bucket-A.obs.cn-north-1.myhwclouds.com/sample.jpg?x-image-process=style/stylename.

Registration