The watermark API is used to process image watermarks. The watermark image must be an image that has already been stored in CI. Currently, this API is applicable for images with a size no greater than 20 MB and length and width both less than 9,999 pixels.
download_url?watermark/1/image/<encodedURL> /gravity/<gravity> /dx/<dx> /dy/<dy> /blogo/<type>
Ignore the spaces and line breaks above.
Operation: watermark. 1 indicates that the watermark is an image watermark.
|download_url||The file access URL in the format of
|/image/||The URL of the watermark image, which must be URL-safe Base64 encoded. For example, the watermark image is
|/gravity/||The position of the text watermark in the Sudoku orientation chart (see the Sudoku Orientation Chart). The default value is SouthEast.|
|/dx/||The horizontal margin in pixels. The default value is 0.|
|/dy/||The vertical margin in pixels. The default value is 0.|
|/blogo/||The watermark image adaptation feature, which is applicable to scenarios in which the watermark image size is too large, for example, a watermark wall. There are two options:
The specified watermark image must meet all the following conditions:
examplebucket-1250000000.image.myqcloud.comis a CDN acceleration domain name, and therefore cannot be used as a watermark URL.
http://. The HTTP header cannot be omitted or replaced by an HTTPS header. For example,
https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.pngare invalid watermark URLs.
A nine-part grid can provide a location reference for various operations performed on an image. The red dot is the origin of each region (after each region is selected by using the
gravity parameter, the displacement operation is performed by taking the corresponding far point as the reference.)
gravityis set to center, the
dyparameters are invalid.
gravityis set to north or south, the
dxparameter is invalid (in which case the watermark is horizontally centered).
gravityis set to west or east, the
dyparameter is invalid (in which case the watermark is vertically centered).
Adding an image watermark
After the image watermark is added, the effect is as follows: