Baidu AI Cloud
中国站

百度智能云

Object Storage

Image Scaling

Overview

This article describes how to scale up and down the photo.

Image Scaling Parameter

Name of action: resize

Parameter Value Description
m lfit, mfit, fill, pad, fixed
  • Sets the width of the thumbnail in px. The lfit type must be set to w or h, and the fill fixed type must be set to w and h at the same time.
  • lfit: Scale the image to the largest scale that can be placed in a rectangle with width and height of w and h.
  • mfit: Scale the image to the smallest scale that can be placed in a rectangle with width and height of w and h.
  • fill: Crop the image part in the rectangles with width and height of w and h on the basis of mfit.
  • pad: Fill the blank part except the image in the rectangles with width and height of w and h on the basis of lfit.
  • fixed: Forces scaling to the specified width (w) and height (h).
w 1-4096
  • Sets the height of the thumbnail in px. The lfit type must be set to w or h, and the fill fixed type must be set to w and h at the same time.
h 1-4096
  • Sets the height of the thumbnail in px. The lfit type must be set to w or h, and the fill fixed type must be set to w and h at the same time.
limit 0,1
  • Set whether to limit the size of the image to be resized not to exceed the size of the original image, where 0 represents unlimited, and 1 represents limited. It is not required, and the number 0 represents unlimited.
color 8-digit hex color code
  • Designate the fill color of the type, where the first six bits represent RGB color, such as ffffff; and the last two bits represent Alpha channel, which can be omitted, and if omitted, it means opaque. It is not required, and the default color is black.

Example

Previous
Usage Rules
Next
Image Cropping