Updated on 2024-03-04 GMT+08:00

Image Watermarks

Image watermark parameters are the parameters used when adding image watermarks.

You can pre-process the image watermark before adding it to the original image. These pre-processing operations include Resizing Images, Rotating Images, and Cropping Images, but does not include cropping it into an inscribed circle. In addition, you can scale the watermark based on the original image when resizing for pre-processing.

Table 1 lists the descriptions for image watermark parameters in detail.

Table 1 Image watermark parameters

Parameter

Value Description

Code Example

image

Watermark image path. This parameter is mandatory when you add a watermark.

The image watermark address is: bucketName/objectName(required code) or bucketName/objectName?x-image-process=image/command(required code).

NOTICE:

The content must be base64 code of URL. encodedObject = url_safe_base64_encode(object). For example, object panda.png will be encoded as cGFuZGEucG5n.

image/resize,w_400/watermark,image_aW1h

Z2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb

2Nlc3M9aW1hZ2UvcmVzaXplLFBfMzA=,t_90,

g_br,x_10,y_10

P

Watermark image size. The watermark image is scaled according to the percentage P of the original image (image to which the watermark is added). The value ranges from 1 to 100.

NOTICE:

The preceding resize operation supports only the uppercase P parameter. To adjust the watermark image size, see Resizing Images (except the p parameter).

image-demo/logo.png?x-image-process=image/resize,P_50

API Call Examples

GUI Example

You can configure image watermarks by editing image style on OBS Console. The watermark file is logo.png (logo address: e-share/image-demo/logo.png). The watermark locates at the bottom right corner, with a transparency of 90 and default horizontal and vertical margins of 10. Perform the following steps on the console:

  1. Log in to OBS Console, in the navigation tree on the left, click the bucket name and choose Data Processing > Image Processing.
  2. Click Create. The style editing page is displayed.
  3. On the editing page, input a style name, set the Edit Mode to GUI, and select Watermark.

    A style name consists of letters (uppercase and lowercase), digits, periods (.), underlines (_), and hyphens (-), and contains 1 to 256 characters, for example, rotate_0001.

  4. Configure the following watermark parameters. For details, see Figure 4.

    • Watermark Type: Choose Image Watermark.
    • Watermark Image Path: Enter e-share/image-demo/logo.png.
    • Image Size (%): Set this parameter based on whether the watermark image is zoomed out.
    • Brightness: Retain the default value 0.
    • Contrast: Retain the default value 0.
    • Transparency: Set this parameter to 90.
    • Watermark Position: Select the arrow at the bottom right.
    • Vertical Margin: Retain the default value 10.
    • Horizontal Margin: Retain the default value 10.
    Figure 4 Configuring image watermarks

  5. After finishing editing the image style, click OK to save the style. The new style will be displayed in the style list.

    You can use the new watermark style to process images by referring to Applying Image Styles.