百度智能云

All Product Document

          Object Storage

          Image Thumbnail

          Overview

          This article describes how to thumbnail the image.

          Image Thumbnail Parameters

          Command parameter

          Parameter name Resizing command Type Value range Request description Default value Is it required
          scale s unsigned int 0,1,2 Designate the resize method.
          s 0 means no cutting, equal scaling;
          s
          1 means stretch scaling;
          s_ 2 means center cutting and scaling in equal proportions.
          0 No
          width w unsigned int 1~4096 Specify the maximum width of the target thumbnail
          The unit will be px.
          - If s_1,
          s_2 is selected,
          must be chosen
          height h unsigned int 1~4096 Designate the maximum height of targeted thumbnail
          which is in px.
          - If s_1,
          s_2 is selected,
          must be chosen
          limit l unsigned int 0,1 Specify whether to limit the size of the photo scaling:
          l_0 means that the size of the photo scaling is not limited;
          l_1 indicates that the scaling size (length and width) of the photo cannot exceed the size of the original image.
          0 No

          Caution

          • If under the situation of s_0, that is, no clipping with uniform scale:
          • Either w or h can be selected, and the photo should be scaled according to the specified parameter scale. For example, if the size of the original drawing is 100 × 200 and the specified parameter is w_50, the size of the photo processing should be 50 × 100; and if the specified parameter is h_50, the size of the photo processing should be 25 × 50.
          • If w and h are specified at the same time, the system will take the parameter with the smaller value of “target width/original width” and “target height/original height” as the standard for equal scale. E.g.: If the size of the original drawing is 400 × 500 , and the specified parameter is w_100, h_200, the system will be scaled according to the scale of w_100, and the target size will be 100 × 125 due to “100/400”< “200/500”. ;
          • When s_1, the values of w and h must be specified at the same time;
          • When s_2, the values of w and h must be specified at the same time. When w and h are specified, the photo will be scaled equally according to the parameter with the smaller value of “target width/original width” and “target height/original height”, and the other side with the larger value will be cropped in the middle. E.g.: If the size of the original drawing is 500 × 1000 , and the specified parameter is s_2, w_250, h_600, the system will be scaled according to the targeted width of 250, and the height will be cropped to 500 in the middle.

          Example

          • Compress the photo to 200 in height, and process the width of the image in scale.

          https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@h_200

          • Compress the photo to 150 in width, 200 in height, 60 in absolute quality and png in format.

          https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@s_1,w_150,h_200,q_60,f_png

          • Crop and scale the photo in an equal scale in the center with a resize width of 80 and a height of 100.

          https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@s_2,w_80,h_100

          • Compress the photo to 150 in width and 100 in height, rotate it 90 degrees counterclockwise, and gradually display it.

          https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@s_1,w_150,h_100,a_-90,d_progressive

          Previous
          Usage Rules
          Next
          Image Cropping