Add Text Watermark
Last Updated:2021-06-07
Overview
Add text watermark to an image.
Text Watermark Parameters
Command name: watermark
.
Parameters | Value | Description |
---|---|---|
text | - | The watermark text content, which needs to be Based64 coded for url security. After being coded, the text should not exceed 200 characters. A text watermark is required. |
size | 1-1024 | The specified watermark font size. It is optional, whose default value is 30. |
color | A 8-bit hexadecimal color code | Specifies the font color, whose format is RRGGBBAA. The Alpha channel for the last 2 bits is ignorable. If ignored, it defaults to 00, indicating that it is opaque. It is optional, whose default value is 000000 . |
type | For the supporting fonts, see the following table. | The font type of the specified font, whose value requires to be Based-coded for url security. It is optional. If the specified font is not in the supported font list, it defaults to the Song typeface. |
style | Normal, italic, and bold | Specifies the font style. Normal, italic, and bold. It is optional and defaults to normal. Rendering the text effect is possible unless the font supports the style effect. |
g | 1-9 | Specify the anchor point position. It is optional and defaults to 9. For specific meaning, see the description below. |
x | -4096-4096 | Specify the horizontal distance of the watermark based on the anchor point. It is optional and defaults to 10. |
y | -4096-4096 | Specify the vertical distance of the watermark based on the anchor point. It is optional and defaults to 10. |
a | -360-360 | Specify the rotating angle of the watermark. The positive number indicates the clockwise rotation, and the negative number indicates the counterclockwise rotation. It is optional and defaults to 0. |
skw | 1-1024 | Specify the text stroke width. It is optional and defaults to 0. |
skc | A 8-bit hexadecimal color code | Specify the text stroke color whose format is RRGGBBAA. The Alpha channel for the last 2 bits is ignorable. If ignored, it defaults to 00, indicating that it is opaque. It is optional, whose default value is 000000 . |
blr | 1-50 | Specify the Gaussian blur radius of the stroke. It is optional and defaults to 0. |
bls | 1-50 | Specify the standard deviation for the Gaussian blur radius of the stroke. It is optional and defaults to 0. |
Anchor Point Position
Divide the original image into the following nine areas, number them according to the position shown in the figure. The anchor point position of each area is as follows:
Supported Font Type
Font | Name | Base64 code |
---|---|---|
FZLanTingHei | Fangzheng Lan Ting Bold Simplified Style | RlpMYW5UaW5nSGVp |
FZLanTingHeiSBGB | Fangzheng Lan Ting Bold Simplified Style | RlpMYW5UaW5nSGVpU0JHQg== |
FZLanTingHeiSDB1GB | Fangzheng Lan Ting Medium Bold Simplified Style | RlpMYW5UaW5nSGVpU0RCMUdC |
FZLanTingHeiSDBGB | FZLanTingHeiSDBGB | RlpMYW5UaW5nSGVpU0RCR0I= |
FZLanTingHeiSEBGB | Fangzheng Lan Ting Big Bold Simplified Style | RlpMYW5UaW5nSGVpU0VCR0I= |
FZLanTingHeiSELGB | Fangzheng Lan Ting Fine Bold Simplified Style | RlpMYW5UaW5nSGVpU0VMR0I= |
FZLanTingHeiSHGB | Fangzheng Lan Ting Extrabold Simplified Style | RlpMYW5UaW5nSGVpU0hHQg== |
FZLanTingHeiSLGB | Fangzheng Lan Ting Thin Bold Simplified Style | RlpMYW5UaW5nSGVpU0xHQg== |
FZLanTingHeiSMGB | Fangzheng Lan Ting Quasi-Bold Simplified Style | RlpMYW5UaW5nSGVpU01HQg== |
FZLanTingHeiSRGB | Fangzheng Lan Ting Bold Simplified Style | RlpMYW5UaW5nSGVpU1JHQg== |
FZLanTingHeiSULGB | Fangzheng Lan Ting Extra-thin Bold Simplified Style | RlpMYW5UaW5nSGVpU1VMR0I= |
FZKaTongM19S | Fangzheng Cartoon Simplified Style | RlpLYVRvbmdNMTlT |
FZFangSong | Fangzheng Fang Song Simplified Style | RlpGYW5nU29uZw== |
FZShuSong | Fangzheng Shu Song Simplified Style | RlpTaHVTb25n |
FZKai | Fangzheng Kai Simplified Style | RlpLYWk= |
FZHei | Fangzheng Bold Simplified Style | RlpIZWk= |
FZDuHeiS | Fangzheng Du Hei Bold Simplified Style | RlpEdUhlaVM= |
Example
- Add the blue text watermark
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/watermark,text_aGVsbG8=,type_RlpMYW5UaW5nSGVp,g_9,color_0000ff
- Add the white text watermark with 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