All Products
Search
Document Center

Intelligent Media Management:AddImageMosaic

Last Updated:Dec 11, 2024

Adds mosaics, Gaussian blurs, or solid color shapes to blur one or more areas of an image for privacy protection and saves the output image to the specified path in Object Storage Service (OSS).

Operation description

  • Before you call this operation, make sure that you are familiar with the billing of Intelligent Media Management (IMM).****
  • Make sure that the specified project exists in the current region. For more information, see Project management.
  • The operation accepts JPG and PNG images with a maximum side length of 30,000 pixels and a total of up to 250 million pixels.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
imm:AddImageMosaicnone
*Project
acs:imm:{#regionId}:{#accountId}:project/{#ProjectName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectNamestringYes

The name of the project.

test-project
SourceURIstringYes

The OSS URI of the input image.

Specify the OSS URI in the oss://${Bucket}/${Object} format, where ${Bucket} is the name of the bucket in the same region as the current project and ${Object} is the path of the object with the extension included.

Supported formats of input images include JPG, PNG, TIFF, JP2, and BMP.

oss://examplebucket/sampleobject.jpg
TargetURIstringYes

The OSS URI of the output image.

Specify the OSS URI in the oss://${Bucket}/${Object} format, where ${Bucket} is the name of the bucket in the same region as the current project and ${Object} is the path of the object with the extension included.

oss://examplebucket/outputImage.jpg
ImageFormatstringNo

The encoding of the output image. By default, the output image uses the same encoding as the input image. Valid values: jpg, png, and webp.

jpg
QualityintegerNo

The quality of the output image. This parameter applies only to JPG and WebP images. Valid values: 0 to 100. Default value: 80.

80
Targetsarray<object>Yes

The bounding boxes and processing parameters.

objectYes

The bounding box and the corresponding processing parameters.

TypestringYes

The type of the mosaic effect. Valid values:

  • square: squares.
  • diamond: diamonds.
  • hexagon: hexagons.
  • blur: Gaussian blurs.
  • pure: solid color shapes.
square
BoundaryobjectYes

The position of the bounding box.

ReferPosstringNo

The reference position of the bounding box on the image. Valid values:

  • topright: the upper-right corner.
  • topleft: the upper-left corner. This is the default value.
  • bottomright: the lower-right corner.
  • bottomleft: the lower-left corner.
topleft
XfloatYes

The horizontal offset relative to the reference position. The value can be an integer greater than or equal to 0 or a decimal within the range of [0,1):

  • An integer value greater than or equal to 0 indicates the horizontal offset in pixels.
  • A decimal value within the range of [0,1) indicates the horizontal offset as a ratio of the offset to the image width.
0
YfloatYes

The vertical offset relative to the reference position. The value can be an integer greater than or equal to 0 or a decimal within the range of [0,1):

  • An integer value greater than or equal to 0 indicates the vertical offset in pixels.
  • A decimal value within the range of [0,1) indicates the vertical offset as a ratio of the offset to the image height.
0
HeightfloatYes

The height of the bounding box. The value can be an integer greater than or equal to 0 or a decimal within the range of [0,1):

  • An integer value greater than or equal to 0 indicates the height of the bounding box in pixels.
  • A decimal value within the range of [0,1) indicates the height of the bounding box as a ratio of its height to the image height.
200
WidthfloatYes

The width of the bounding box. The value can be an integer greater than or equal to 0 or a decimal within the range of [0,1):

  • An integer value greater than or equal to 0 indicates the width of the bounding box in pixels.
  • A decimal value within the range of [0,1) indicates the width of the bounding box as a ratio of its width to the image width.
200
MosaicRadiusintegerNo

The radius of the mosaic. Default value: 5. Unit: pixels.

Note This parameter does not take effect for Gaussian blurs and solid color shapes.
5
BlurRadiusintegerNo

The radius of the Gaussian blur. Valid values: 1 to 50. Default value: 3. Unit: pixels.

Note This parameter takes effect only for a Gaussian blur.
3
SigmaintegerNo

The standard deviation of the Gaussian blur. The value must be greater than 0. Default value: 5.

Note This parameter takes effect only for a Gaussian blur.
5
ColorstringNo

The color of the color shape. You can specify a color by using a color code such as#RRGGBB or preset color names such as red and white. The default value is #FFFFFF, which is white.

Note This parameter takes effect only for solid color shapes.
#FFFFFF
CredentialConfigCredentialConfigNo

If you do not have special requirements, leave this parameter empty.

The configurations of authorization chains. For more information, see Use authorization chains to access resources of other entities.

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

CA995EFD-083D-4F40-BE8A-BDF75FF*****

Examples

Sample success responses

JSONformat

{
  "RequestId": "CA995EFD-083D-4F40-BE8A-BDF75FF*****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history