Updated on 2024-08-09 GMT+08:00

Text Watermarks

You can configure the size, font, and color for text images. Table 1 describes the parameters.

Table 1 Text watermark parameters

Parameter

Value Description

Code Example

text

Mandatory for adding text watermarks

NOTICE:

The content must be URL-safe Base64 encoded in the encodeText = url_safe_base64_encode(fontText) format, with a maximum of 64 characters (16 full-width characters at most).

image/watermark,text_SGVsbG8g5Zu-

54mH5pyN5YqhIQ,size_60,color_FF0000,type_

ZmFuZ3poZW5nc2h1c29uZw==,g_center,rotate_30

size

Optional. It represents the size of a text watermark, ranging from 0 (exclusive) to 1000 (inclusive). The default value is 40.

type

Optional. It represents the font of a text watermark. Available values are those shown in Table 2. The default value is wqy-zenhei (d3F5LXplbmhlaQ after encoding).

NOTICE:

- The content must be URL-safe Base64 encoded in the encodeText = url_safe_base64_encode(fontType) format.

- Line breaks are currently not supported.

color

Optional. It represents the color of a text watermark.

The value is a six-digit hexadecimal code, from 000000 (default value, representing black) to FFFFFF.

shadow

Optional. It represents the transparency of a text watermark. The value ranges from 0 (exclusive) to 100 (inclusive).

fill

Optional. It represents the filling effect of a text watermark. The value can be 0 or 1.

  • 0: filling not applied
  • 1: filling applied

rotate

Optional. It represents the clockwise rotation angle of a text watermark. The value ranges from 0 (exclusive) to 360 (exclusive).

Table 2 Text font encoding

Parameter

Value After URL-Safe Base64 Encoding

Value Description

Remarks

droidsansfallback

ZHJvaWRzYW5zZmFsbGJhY2s=

DroidSansFallback

According to Request for Comments (RFC), the fuller "=" can be omitted, and the value becomes ZHJvaWRzYW5zZmFsbGJhY2s.

fangzhengfangsong

ZmFuZ3poZW5nZmFuZ3Nvbmc=

FZFongSong

According to RFC, the fuller "=" can be omitted, and the value becomes ZmFuZ3poZW5nZmFuZ3Nvbmc.

fangzhengheiti

ZmFuZ3poZW5naGVpdGk=

FZSimHei

According to RFC, the fuller "=" can be omitted, and the value becomes ZmFuZ3poZW5naGVpdGk.

fangzhengkaiti

ZmFuZ3poZW5na2FpdGk=

FZKaiTi

According to RFC, the fuller "=" can be omitted, and the value becomes ZmFuZ3poZW5na2FpdGk.

fangzhengshusong

ZmFuZ3poZW5nc2h1c29uZw==

FZShuSong

According to RFC, the fuller "=" can be omitted, and the value becomes ZmFuZ3poZW5nc2h1c29uZw.

wqy-microhei

d3F5LW1pY3JvaGVp

WenQuanYi Micro Hei

-

wqy-zenhei

d3F5LXplbmhlaQ==

WenQuanYi Zen Hei

According to RFC, the fuller "=" can be omitted, and the value becomes d3F5LXplbmhlaQ.

Examples of Making API Calls