All Products
Search
Document Center

Intelligent Media Management:AddImageMosaic

Last Updated:Aug 28, 2026

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.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

imm:AddImageMosaic

none

*Project

acs:imm:{#regionId}:{#accountId}:project/{#ProjectName}

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectName

string

Yes

The name of the project.

test-project

SourceURI

string

Yes

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

TargetURI

string

Yes

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

ImageFormat

string

No

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.

Valid values:

  • jpg :

    jpg

  • png :

    png

  • webp :

    webp

jpg

Quality

integer

No

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

80

Targets

array<object>

Yes

The bounding boxes and processing parameters.

array<object>

No

The bounding box and the corresponding processing parameters.

Type

string

Yes

The type of the mosaic effect. Valid values:

  • square: squares.

  • diamond: diamonds.

  • hexagon: hexagons.

  • blur: Gaussian blurs.

  • pure: solid color shapes.

square

Boundary

object

Yes

The position of the bounding box.

ReferPos

string

No

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

X

number

Yes

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

Y

number

Yes

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

Height

number

Yes

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

Width

number

Yes

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

MosaicRadius

integer

No

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

BlurRadius

integer

No

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

Sigma

integer

No

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

Color

string

No

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

CredentialConfig CredentialConfig

No

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

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

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

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

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.