Image Watermark Parameters

Image watermark parameters are the parameters used when adding image watermarks.

You can pre-process the image watermark before adding it to the original image. These pre-processing operations include Resizing, Rotation, and Cropping, but does not include cropping it into an inscribed circle. In addition, you can scale the watermark based on the original image when resizing for pre-processing.

Table 1 lists the descriptions for image watermark parameters in detail.

Table 1 Image watermark parameters

Parameter

Value Description

Code Example

image

Required parameter when adding image watermarks.

The image watermark address is: bucketName/objectName(required code) or bucketName/objectName?x-image-process=image/command(required code).

NOTICE:

The content must be base64 code of URL. encodedObject = url_safe_base64_encode(object). For example, if the object is "panda.png", the content after coding will be "cGFuZGEucG5n".

image/resize,w_400/watermark,image_aW1hZ2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMzA=,t_90,g_br,x_10,y_10

P

Capitalized P, representing the percentage of scaling to the original image watermark. P ranges [1, 100].

image/resize,P_30

Example

With P, you can dynamically adjust the size of image watermarks based on the original size.

For example, if you scale the logo.png down by 30%, the watermark file will be: image-demo/logo.png?x-image-process=image/resize,P_30 (The code after URL base64 encoding is: aW1hZ2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMzA=).

If you want to scale the width of the original image to 400 and add a watermark in the bottom right corner, set the parameter as:

https://obs.cn-north-1.myhwclouds.com/ya89soshla6s4uma-ims-example-cn-north-1/example.jpg?x-image-process=image/resize,w_400/watermark,image_aW1hZ2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMzA=,t_90,g_br,x_10,y_10

Registration