A text watermark adds text to an image.
Access type
@watermark=2&text=<encodeText>&type=<encodeType>&size=<size>&color=<encode colr>&t=<t>&p=<p>&x=<x>&voffset=<offset>&y=<y>The watermark and object parameters are required.
The term `url_safe_base64_encode` in this document refers to URL-safe Base64 encoding. For more information, see Keywords.
Parameters
Name | Description | Value | Type |
text | The text content of the watermark. This value must be encoded. Note The value must be URL-safe Base64 encoded. | Required | |
type | The font of the watermark text. This value must be encoded. Note The value must be URL-safe Base64 encoded. | Valid values: See the Font type encoding table. Default value: `wqy-zenhei`. The encoded value is `d3F5LXplbmhlaQ`. | Optional |
color | The color of the watermark text. This value must be encoded. Note The value must be URL-safe Base64 encoded. | Default value: `#000000` (black). The Base64-encoded value is `IzAwMDAwMA`. | Optional parameters |
size | The font size of the watermark text in pixels (px). | Valid values: (0, 1000]. Default value: 40. | Optional |
s | The transparency of the watermark text shadow. | Valid values: (0, 100]. | Optional parameters |
For information about watermark position parameters, see Basic parameters.
Font type encoding table
Parameter value | Meaning in Chinese | URL-safe Base64 encoded value | Notes |
wqy-zenhei | WenQuanYi Zen Hei | d3F5LXplbmhlaQ== | The padding character (=) can be omitted based on RFC specifications. The value then becomes `d3F5LXplbmhlaQ`. |
wqy-microhei | WenQuanYi Micro Hei | d3F5LW1pY3JvaGVp | None |
fangzhengshusong | FangZheng ShuSong | ZmFuZ3poZW5nc2h1c29uZw== | The padding character (=) can be omitted based on RFC specifications. The value then becomes `ZmFuZ3poZW5nc2h1c29uZw`. |
fangzhengkaiti | FangZheng KaiTi | ZmFuZ3poZW5na2FpdGk= | The padding character (=) can be omitted based on RFC specifications. The value then becomes `ZmFuZ3poZW5na2FpdGk`. |
fangzhengheiti | FangZheng HeiTi | ZmFuZ3poZW5naGVpdGk= | The padding character (=) can be omitted based on RFC specifications. The value then becomes `ZmFuZ3poZW5naGVpdGk`. |
fangzhengfangsong | FangZheng FangSong | ZmFuZ3poZW5nZmFuZ3Nvbmc= | The padding character (=) can be omitted based on RFC specifications. The value then becomes `ZmFuZ3poZW5nZmFuZ3Nvbmc`. |
droidsansfallback | DroidSansFallback | ZHJvaWRzYW5zZmFsbGJhY2s= | The padding character (=) can be omitted based on RFC specifications. The value then becomes `ZHJvaWRzYW5zZmFsbGJhY2s`. |
Examples
Add a text watermark
This is an example of a simple watermark. The text is "Hello, Image Service!".

Add a text watermark with styles
This example adds a styled text watermark. The text "Hello, Image Service!" is displayed in the WenQuanYi Zen Hei font at size 40 and in white (#FFFFFF), with a text shadow of 50. The watermark is positioned in the center-right with a horizontal margin of 10 and a vertical offset of 20 from the midline.
