This API is used to provide real-time text watermarking in Tencent Cloud CI. The size of the input image to be processed cannot exceed 20 MB, its width and height cannot exceed 30,000 pixels respectively, and its total pixels cannot exceed 250 million. The width and height of the output image cannot exceed 9,999 pixels respectively. For animated images, the input image's Width x Height x Number of frames cannot exceed 250 million pixels.
download_url?watermark/2/text/<encodedText> /font/<encodedFont> /fontsize/<fontSize> /fill/<encodedColor> /dissolve/<dissolve> /gravity/<gravity> /dx/<dx> /dy/<dy> /batch/<type> /degree/<degree>
Please ignore the preceding spaces and line breaks.
Operation name: watermark. The number 2 indicates the watermark type is text watermark.
|download_url||URL that is used to access a file. The URL form is
|/text/||Watermark content, which is encoded with Base64 that is safe to the URL.|
|/font/||Watermark font, which is encoded with Base64 that is safe to the URL. The default value is tahoma.ttf.|
|/fontsize/||Watermark text fontsize in pounds. The default value is 13.|
|/fill/||Watermark font color, which must be set to the hexadecimal RGB format (such as #FF0000). The default value is gray. For more information, see RGB Code Table. The value must be encoded with Base64 that is safe to the URL. The default value is #3D3D3D.|
|/dissolve/||Text transparency. Value range: 1-100. The default value is 90 (90% non-transparent).|
|/gravity/||Text watermark position, which is a 3x3 grid position (See the 3x3 grid position diagram). The default value is SouthEast.|
|/dx/||Horizontal margin in pixels. The default value is 0.|
|/dy/||Vertical margin in pixels. The default value is 0.|
|/batch/||Tiled watermarking, which can tile the text watermark to the entire image. If you set batch to 1, tiled watermarking is enabled.|
|/degree/||Rotation angle of the text watermark. Value range: 0 - 360. The default value is 0.|
A 3x3 grid position diagram provides position reference for multiple image operations. Red dots show the origin points of each region. After you use the gravity parameter to select a region, displacement must be based on the corresponding origin point.
- When the gravity parameter is set to center, the dx and dy parameters are invalid.
- When the gravity parameter is set to north or south, the dx parameter is invalid, and the watermark is centered horizontally.
- When the gravity parameter is set to west or east, the dy parameter is invalid, and the watermark is centered vertically.
This example shows you how to add a text watermark.
After the text watermark is added, the effect is as follows: