Updated on 2023-07-21 GMT+08:00

Public Parameters

You can use the GUI, code, or APIs to configure public parameters.

You can add a text or image watermark to the original image.

The Base64 code for URL transmission applies to paths of content and fonts of text watermarks, or paths of image watermarks. It is not advisable to put standard Base64 code directly into the URL for transmission. In Base64 encoding for URL transmission, contents are coded into character strings by standard Base64 code. After verifying these strings, replace the plus sign (+) with hyphen (-), and slash (/) with underline (_). For details about encoding, see those specified in RFC4648.

Operation name: watermark

Public parameters are applicable to setting image watermarks and text watermarks. You can add text watermarks and image watermarks to the same image. Table 1 lists the basic parameters in detail.

Table 1 Public Parameters

Parameter

Value Description

Code Example

g

Optional, represents the location of the watermark: tl, top, tr, left, center, right, bl, bottom, and br. The default value is tl.

Figure 1 is the 3 x 3 grid illustrating these values. Each value locates at the top left corner of a grid.

image/watermark,image_aW1hZ2UtZGVtby

9sb2dvLnBuZw==,g_br,t_90,x_10,y_10

x

Optional parameter, representing the horizontal distance from the image edge. By default, the origin is at the top left corner. x ranges [0, 4096]. It is set to 10 by default, with the unit pixel (px).

y

Optional parameter, representing the vertical distance from the image edge. By default, the origin is at the top left corner. x ranges [0, 4096]. It is set to 10 by default, with the unit pixel (px).

voffset

Optional parameter, representing the vertical offset from the horizontal centerline of the image. This parameter offsets the watermark up or down from the horizontal centerline of the image. voffset ranges [-1000, 1000]. It is set to 0 by default, with the unit pixel (px).

voffset is meaningful only when g is set to left, center, or right. That is to say, the watermark locates in the left, center, or right grid.

align

Optional parameter, representing the align mode of the text watermark and the image watermark. The value can be 0, 1, or 2. It is set to 0 by default.

  • 0: The top edges of the text watermark and the image watermark are aligned.
  • 1: The centerlines of the text watermark and the image watermark are aligned.
  • 2: The bottom edges of the text watermark and the image watermark are aligned.

order

Optional parameter, representing the sequence of the text watermark and the image watermark. The value can be 0 (default value) or 1.

  • 0: Image in front, text behind.
  • 1: Text in front, image behind.

t

Optional parameter, representing the extent of transparency of the text or image watermark. t ranges [0, 100]. The default value is 100, indicating the watermark is not transparent at all.

interval

Optional parameter, representing the distance between the text watermark and image watermark. The interval ranges [0, 1000].

Figure 1 is the 3 x 3 grid illustrating the location of the watermark.

Figure 1 3 x 3 grid of watermark location

If both a text watermark and an image watermark are added to the original image, the location of the watermark can be adjusted by the horizontal distance x, vertical distance y, and the vertical offset from the horizontal centerline voffset. You can adjust the layout of the two watermarks as well.