百度智能云

All Product Document

          Object Storage

          Usage Rules

          Overview

          BOS photo Processing V2.0 is a brand-new processing protocol for BOS. Compared with the V1.0 version, the V2.0 version supports more photo processing features and uses a brand-new command method. You can still access the BOS photo processing service through the BOS image processing V1.0 version, but the features of the V1.0 version will no longer be updated in the future.

          Before using the BOS photo processing feature, you need to upload the original image to BOS. Each Bucket of BOS has enabled photo processing by default, and you do not need to activate it additionally, nor do you need to use a specific domain name to access image processing services. When accessing the photo URL, specify the image processing command through the x-bce-process metric in the Querystring to trigger the BOS image processing feature.

          Note

          • In order to improve the security of photo s, BOS also supports enabling original image protection for images in a specified Bucket. That is to say, if the image collector does not verify the authorized signature after the original image protection is turned on, the processed image can only be accessed through the style mode, and the direct access to the original image or the access through the processing parameters will be denied. Currently, the original image protection feature can be enabled/disabled in the console, and related operations are also supported through API, and the effective range of this feature can be specified through the resource field.

          Rules and Restrictions

          • Supported original photo format: jpg, png, bmp, webp, heic and gif;
          • Supported target photo format: jpg, png, bmp, webp, heic and gif;
          • Both the width and height of the output image of the processing result shall not exceed 4096px, including the intermediate output image between the pipeline and the subcommand.
          • You can specify up to 4 groups of actions at the same time, that is, four actions.
          • The same parameter cannot be specified repeatedly under an action.
          • The style name supports the combination of numbers, letters and underscores, and the first character cannot be an underscore, and the maximum length is 64 characters.

          Access Format

          BOS It supports access to image services through commands and styles.

          Command access format

          The photo processing command form is:

          x-bce-process=image/${action},${key}\_${value},${key}\_${value}/${action},${key}\_${value} 

          Among them,

          • image: BOS supports a variety of data processing forms, which are triggered by the x-bce-process parameter, and when using image processing, you need to specify the name here as image.
          • action: BOS supports a variety of image processing commands, each of which is called an action, such as resize, crop crop, etc.
          • key: Each action supports a variety of specific processing parameters, such as width (w) and height (h) resized.
          • value: Value of processing parameter
          • Separator :
          Separator name Separator Order of both sides Description
          Process separators / related The separator between multiple actions should be executed in sequence of actions
          Parameter separator , Non-related Separator between multiprocessing parameter items
          Value separator _ Permanent order Separator between parameter name and parameter value

          If the photo is scaled proportionally, and the scaled image has a maximum width of 200 and a maximum height of 100, the corresponding command is:

          http://bucket-A.bj.bcebos.com/sample.jpg?x-bce-process=image/resize,m_lfit,w_200,h_100 

          Style access format

          You can save one or more photo processing commands as a style, and create a name for the style. You can access the image processing through the style name, which simplifies the original series of complex command operations and metrics, and the same effect can be achieved through a short URL.

          The access format via style is:

          http://${domain}/${objectkey}?x-bce-process=style/${stylename} 

          Among them,

          • style: When adopting access of image style, you need to specify the name here as style.
          • stylename: The name of the style accessed.

          For example, you create a style named mystylename to achieve a maximum scaling of equal proportions with a width of 200 px and a height of 300 px, and synchronously support adaptive rotation (the command is: pxresize, m_lfit, limit_0, w_200, h_300/auto-orient, o_1), You can directly call the name of mystylename to access image processing:

          http://bucket-A.bj.bcebos.com/sample.jpg?x-bce-process=style/mystylename 

          Note

          • BOS photo processing commands consist of two versions, new and old. Therefore, the actual image processing commands corresponding to one image processing style can be the new version or the old version.
          • The access mode of x-bce-process=style/${stylename} can only be used to access the style corresponding to the new version command, while the style corresponding to the old version command still needs to be accessed through the old version @.

          Add/Delete Style

          You can add or delete styles through the BOS console.

          1. Log in to Baidu AI Cloud official website

          Log in to Baidu AI Cloud official website.

          • If you do not register an account, you must first Register an Account for operation.
          • If you have registered an account, you can directly Login.

          2. Enter the BOS console

          In the navigation bar on the left side of the page, select "Storage and CDN > BOS" to enter the BOS console.

          3. Select Bucket and enter the image processing page

          Select the Bucket name in the Bucket list on the left and enter the image processing page. On this page, you can create a new image processing style, or you can view the created image processing style in the list.

          4. Adding mode

          Click the Add Style button to enter the Add Style page. Regarding the style setting method of the image processing protocol V2.0, you can check Image processing protocol 2.0 ; For the style setting method of the image processing protocol V1.0, you can check Image Processing Protocol 1.0.

          In the console, you can edit styles through basic editing methods and advanced editing methods. The basic editing method is to edit the style through a graphical interface, while the advanced editing method requires you to enter the corresponding command statement to set.

          In basic editing, you can set style name and thumbnail settings.

          You can also perform output settings and watermark settings for the image.

          In advanced editing, you can set directly through the command line. Please refer to Photo Processing Service 2.0 and Image Processing Protocol 1.0 for the specific operation of the command line of the image service.

          5. Add list

          After the style is added, it will be displayed in the style list of image processing. You can view the command corresponding to the style through the "View Command" in the operation column, preview the style, or edit and delete the style.

          Note

          • The styles generated by the image processing protocol 2.0 are only displayed in the list of the new version of the protocol; the styles generated by the image processing protocol 1.0 are only displayed in the list of the old version of the protocol. The styles under the two protocols will not be displayed together, please view by switching version at the top of the page.
          Previous
          Image General Settings
          Next
          Image Scaling