Watermarks help protect image copyrights and promote your brand. Edge Security Acceleration (ESA) supports text and image watermarks. You can place watermarks at specific positions on an image and adjust their transparency.
Parameters
image_process=watermark
-
Basic parameters (watermark positions)

|
Parameter |
Description |
Value range |
|
t |
The opacity of the watermark. |
Default value: |
|
g |
The position of the watermark on the image. |
|
|
x |
The horizontal margin between the watermark and the image edge. This parameter takes effect only when the watermark is at the left or right side of the image. |
Default value: |
|
y |
The vertical margin between the watermark and the image edge. This parameter takes effect only when the watermark is at the top or bottom of the image. |
Default value: |
You can use x, y, and offset to adjust watermark positions. These parameters also help arrange layouts when an image has multiple watermarks.
-
Image watermark parameters
|
Parameter |
Description |
Value range |
|
image |
The URL of the watermark image, which must be publicly accessible. If the URL requires authentication or specific permissions, ESA may fail to retrieve the image. The URL must be Base64-encoded. For more information, see Encode watermarks. |
Base64-encoded strings |
-
Text watermark parameters
|
Parameter |
Description |
Value range |
|
text |
The text watermark content, which must be Base64-encoded. For more information, see Encode watermarks. |
A Base64-encoded string of up to 60 characters |
|
type |
The font of the text watermark, which must be Base64-encoded. For more information, see Encode watermarks. |
You can specify up to 10 fonts. For information about supported fonts and their encoded values, see type settings and encoding. |
|
color |
The color of the text watermark, specified as an RGB hex value. |
For example, 000000 specifies black, and FFFFFF specifies white. Default value: |
|
rotate |
The clockwise rotation angle of the text watermark. |
Default value: |
|
fill |
Specifies whether to tile the image with the text watermark. |
Valid values:
|
|
size |
The font size of the text watermark. |
Default value: Unit: |
type settings and encoding
|
Text font |
Description |
Encoded value |
|
alihyaihei |
A bold font. This is the default font. |
YWxpaHlhaWhlaQ |
|
hysong |
A Songti font variant. |
aHlzb25n |
|
hyhei |
A Heiti font variant. |
aHloZWk |
|
hyshuangxian |
A double line font. |
aHlzaHVhbmd4aWFu |
|
fzltzhk |
A Heiti font variant. |
ZnpsdHpoaw |
|
fzshengsks |
A regular script font. |
ZnpzaGVuZ3Nrcw |
|
fzqusongjian |
A Songti font variant. |
ZnpxdXNvbmdqaWFu |
|
zzgfxingyan |
An artistic font. |
enpnZnhpbmd5YW4 |
|
comfortaa |
Comfortaa |
Y29tZm9ydGFh |
|
notosans |
NotoSans |
bm90b3NhbnM |
If you specify a font not in the list above, the default font alihyaihei is used.
Encode watermarks
When you add watermarks, you must Base64-encode the text content and font name, or the image watermark URL, using URL-safe characters. To encode watermarks, perform the following steps:
-
Encode the watermark content in Base64.
We recommend that you use URL-safe Base64 encoding tools to encode the text content, font names, and image watermark URLs. Base64-encoded watermark content applies only to watermark-specific parameters. Do not include Base64-encoded watermark content in signature strings.
-
Replace characters in the Base64-encoded watermark content based on the following rules:
-
Replace the plus signs (
+) with hyphens (-). -
Replace the forward slashes (
/) with underscores (_). -
Omit the equal signs (
=) at the end of the Base64-encoded watermark content.
-
Examples
-
Add the "Hello World" text watermark.
Encode the Hello World text watermark in URL-safe Base64. For more information, see Encode watermarks. The encoded text is SGVsbG8gV29ybGQ. The encoded hysong font value is aHlzb25n. The image processing URL is http(s)://example.com/image01.png?image_process=watermark,text_SGVsbG8gV29ybGQ,type_aHlzb25n.
-
Add text and image watermarks.
-
Encode the "Happy New Year" text watermark in URL-safe Base64 to get the
5paw5bm05b-r5LmQstring. Set the watermark position to lower right, horizontal margin to 10 pixels, and vertical offset to 10 pixels by usingg_se,x_10,y_10. -
Encode the
http://example-test.oss-ap-southeast-1.aliyuncs.com/image/shuiyin.pngimage watermark URL in URL-safe Base64 to get theaHR0cDovL2V4YW1wbGUtdGVzdC5vc3MtYXAtc291dGhlYXN0LTEuYWxpeXVuY3MuY29tL2ltYWdlL3NodWl5aW4ucG5nstring. Set the watermark position to upper left, horizontal margin to 10 pixels, and vertical offset to 10 pixels by usingg_nw,x_10,y_10. -
Specify the image processing URL as
http(s)://example.com/image01.png?image_process=watermark,text_5paw5bm05b-r5LmQ,g_se,x_10,y_10/watermark,image_aHR0cDovL2V4YW1wbGUtdGVzdC5vc3MtYXAtc291dGhlYXN0LTEuYWxpeXVuY3MuY29tL2ltYWdlL3NodWl5aW4ucG5n,g_nw,x_10,y_10.
-