Add Text Watermark
Updated at:2025-11-03
Overview
Embed a text watermark into an image.
Text watermark parameters
Command name: watermark.
| Parameters | Value | Description |
|---|---|---|
| text | - | The watermark text content must be encoded using URL-safe Base64, ensuring the encoded result does not exceed 200 characters. A text watermark is mandatory. |
| size | 1-1024 | Set the font size of the watermark. This is optional, with a default value of 30. |
| color | 8-bit hexadecimal color code | Specify the font color in the format of RRGGBBAA. The last 2 digits (Alpha channel) can be omitted; if omitted, the default is 00, indicating opacity. Optional; the default color is black 000000. |
| type | Supported fonts are listed in the table below | Specify the font type, which must also be URL-safe Base64 encoded. This is optional, and if the provided font is not within the supported list, the default font (Song) will be applied. |
| style | normal、italic、bold | Define the font style, which can be normal, italic, or bold. This is optional, with the default style being normal. Text effects are rendered only when the font supports these styles. |
| g | 1-9 | Determine the anchor point position for the watermark. This is optional, and the default value is 9. For detailed descriptions, refer to the section below. |
| x | -4096-4096 | Define the horizontal offset of the watermark relative to the anchor point. This setting is optional, with a default value of 10. |
| y | -4096-4096 | Define the vertical distance of the watermark from its anchor point. This is optional, with a default value of 10. |
| a | -360-360 | Set the watermark's rotation angle. Positive values mean a clockwise rotation, while negative values indicate a counterclockwise rotation. This is optional, with a default value of 0. |
| skw | 1-1024 | Set the stroke width for the text. This is optional, with a default value of 0. |
| skc | 8-bit hexadecimal color code | Specify the text stroke color, in RRGGBBAA format. The last 2 digits (Alpha channel) can be omitted; if omitted, the default is 00, indicating opacity. Optional; the default color is black 000000. |
| blr | 1-50 | Set the Gaussian blur radius for the stroke. This is optional, with a default value of 0. |
| bls | 1-50 | Set the standard deviation of the Gaussian blur for the stroke. This is optional, with a default value of 0. |
| layout | tile | Choose the watermark layout. Options include Tile (tiling). This is optional, with a default value of none. Refer to the examples for specific effects. |
Watermark encoding
When adding a watermark, details like the text content and font must be encoded using URL-safe Base64. The encoding steps are as follows:
- Convert the content into Base64 format and then modify some characters in the result.
- Replace all plus signs (+) in the result with hyphens (-).
- Replace all forward slashes (/) in the result with underscores (_).
- Remove all trailing equal signs (=) from the result.
Anchor point position
Divide the original image into 9 regions as shown in the figure below, and number them according to the positions shown in the diagram. The anchor points of each region are shown in the figure:

Supported font types
| Font | Name | base64 encoding |
|---|---|---|
| FZLanTingHei | Founder Lan Ting Hei Simplified Chinese | RlpMYW5UaW5nSGVp |
| FZLanTingHeiSBGB | Founder Lan Ting Hei Bold Simplified Chinese | RlpMYW5UaW5nSGVpU0JHQg== |
| FZLanTingHeiSDB1GB | Founder Lan Ting Hei Medium Bold Simplified Chinese | RlpMYW5UaW5nSGVpU0RCMUdC |
| FZLanTingHeiSDBGB | Founder Lanting Medium Hei Simplified Chinese | RlpMYW5UaW5nSGVpU0RCR0I= |
| FZLanTingHeiSEBGB | Founder Lan Ting Hei Heavy Simplified Chinese | RlpMYW5UaW5nSGVpU0VCR0I= |
| FZLanTingHeiSELGB | Founder Lan Ting Hei Light Simplified Chinese | RlpMYW5UaW5nSGVpU0VMR0I= |
| FZLanTingHeiSHGB | Founder Lan Ting Hei Extra Bold Simplified Chinese | RlpMYW5UaW5nSGVpU0hHQg== |
| FZLanTingHeiSLGB | Founder Lan Ting Hei Thin Simplified Chinese | RlpMYW5UaW5nSGVpU0xHQg== |
| FZLanTingHeiSMGB | Founder Lan Ting Hei Semi Bold Simplified Chinese | RlpMYW5UaW5nSGVpU01HQg== |
| FZLanTingHeiSRGB | Founder Lan Ting Hei Simplified Chinese | RlpMYW5UaW5nSGVpU1JHQg== |
| FZLanTingHeiSULGB | Founder Lan Ting Hei Ultra Light Simplified Chinese | RlpMYW5UaW5nSGVpU1VMR0I= |
| FZKaTongM19S | Founder Cartoon Simplified Chinese | RlpLYVRvbmdNMTlT |
| FZFangSong | Founder Imitation Song Simplified Chinese | RlpGYW5nU29uZw== |
| FZShuSong | Founder Book Song Simplified Chinese | RlpTaHVTb25n |
| FZKai | Founder Kai Script Simplified Chinese | RlpLYWk= |
| FZHei | Founder Black Simplified Chinese | RlpIZWk= |
| FZDuHeiS | Founder Du Hei Simplified Chinese | RlpEdUhlaVM= |
Example
- Add a text watermark with blue text:
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/watermark,text_aGVsbG8=,type_RlpMYW5UaW5nSGVp,g_9,color_0000ff

- Add a text watermark with white text and blue stroke
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/watermark,text_aGVsbG8=,type_RlpMYW5UaW5nSGVp,size_36,g_9,color_ffffff,skw_1,skc_0000ff

- Add a text watermark using the tiling layout:
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/watermark,text_aGVsbG8=,size_30,g_3,x_20,y_20,a_45,layout_tile

