百度智能云

All Product Document

          Object Storage

          Add Mixed Image and Text Watermark

          Overview

          This document introduces how to add the watermark to the image and text. The command name is as follows: watermark.

          Image Watermark Parameters

          Image Watermark Parameters

          Parameters Value Description
          bucket - Specify the bucket name of watermark images stored in BOS, which is optional. It is the current bucket by default. If it is not the current bucket, this watermark image is required to have the public read permission.
          image - Specify the object name of watermark image stored in BOS. You need to take the URL security value with Base64 encoding.
          t 1*100 Specify the transparency of the image watermark. When the value is 100, it indicates that it is consistent with the original transparency. It is optional. The default value is 100.

          Text Watermark Parameters

          Parameters Value Description
          text - The watermark text content needs to be Base64 encoded for URL security, and cannot exceed up to 200 characters after Base64 encoding.
          size 1*1024 Specify the font size of the watermark. This item is optional. The default value is 30.
          color 8-bit hex color code Specify the font color. This item is optional. It is black 000000 by default.
          type For the fonts supported, see the table below. Specify the font type. The value need to be Base64 encoded for URL security. This item is required. If the specified font is not in the list of fonts supported, it is the Song typeface by default.
          style normal, italic, bold Specify the font style. It is normal, italic, and bold. This item is optional. It is normal by default. Only when the font supports the style effect, the text effect is rendered.
          effect hardshadow, softoutline Text effect. hardshadow: text projection. softoutline: text projection. The projection increases the Gaussian blur.
          shx 0-10 Horizontal offset of the text effect. This item is optional. The default value is 0.
          shy 0-10 Vertical offset of the text effect. This item is optional. The default value is 0.
          shc 8-bit hex color code Specify the shadow color.
          blr 1*50 Specify the radius of the Gaussian blur for the outline. It is only effective in the softoutline. This item is optional. The default value is 0.
          bls 1*50 Specify the standard deviation of the Gaussian blur for the outline. It is only effective in the softoutline. This item is optional. The default value is 0.

          Common Parameter

          Parameters Value Description
          g 1*9 Specify the anchor location of the watermark. This item is optional. The default value is 9. For the specific meaning, see the description below.
          x -4096-4096 Specifies the horizontal distance of watermark based on the anchor. Optional. The default value is 10.
          y -4096-4096 It specifies the vertical distance of watermark based on the anchor. Optional. The default value is 10.
          a -360-360 It specifies the rotation angle of watermark. A positive number indicates clockwise rotation, and a negative number indicates the anticlockwise rotation. Optional. The default value is 0.
          order 0.1 Specify the order of text and image watermarks. 0 (Default value): indicates that the image watermark is over the image. 1: indicates that the text watermark is over the text.
          align 0,1,2 Specify the alignment of the text watermark and image watermark. 0: Top alignment of the text watermark and image watermark. 1: Center alignment of the text watermark and image watermark. 2 (default): Bottom alignment of text watermark and image watermark.
          interval 0*1000 Specify the space between the text watermark and image watermark. This item is optional. The default value is 0.

          Anchor Location

          Divide the original image into 9 areas as shown in the figure below, and number them according to the location shown in the figure. The anchor location of each area is shown in the figure:

          gravity.png

          Supported font type

          Font Name Base64 Code
          FZLanTingHei FZLantingHei SC RlpMYW5UaW5nSGVp
          FZLanTingHeiSBGB FZLantingCuHei SC RlpMYW5UaW5nSGVpU0JHQg==
          FZLanTingHeiSDB1GB FZLantingZhongCuHei SC RlpMYW5UaW5nSGVpU0RCMUdC
          FZLanTingHeiSDBGB FZLantingZhongHei SC RlpMYW5UaW5nSGVpU0RCR0I=
          FZLanTingHeiSEBGB FZLantingDaHei SC RlpMYW5UaW5nSGVpU0VCR0I=
          FZLanTingHeiSELGB FZLantingQianHei SC RlpMYW5UaW5nSGVpU0VMR0I=
          FZLanTingHeiSHGB FZLantingTeHei SC RlpMYW5UaW5nSGVpU0hHQg==
          FZLanTingHeiSLGB FZLantingXiHei SC RlpMYW5UaW5nSGVpU0xHQg==
          FZLanTingHeiSMGB FZLantingZhunHei SC RlpMYW5UaW5nSGVpU01HQg==
          FZLanTingHeiSRGB FZLantingHei SC RlpMYW5UaW5nSGVpU1JHQg==
          FZLanTingHeiSULGB FZLantingChaoXiHei SC RlpMYW5UaW5nSGVpU1VMR0I=
          FZKaTongM19S FZKaTong SC RlpLYVRvbmdNMTlT
          FZFangSong FZFangSong SC RlpGYW5nU29uZw==
          FZShuSong FZShuSong SC RlpTaHVTb25n
          FZKai FZKaiTi SC RlpLYWk=
          FZHei FZHeiTi SC RlpIZWk=
          FZDuHeiS FZDuhei SC RlpEdUhlaVM=

          Example

          Previous
          Add Photo Watermark
          Next
          Get Photo Information