Image Watermarks
You can pre-process an image watermark before adding it to an image.
The pre-processing operations include those described in Resizing Images, Rotating Images, and Cropping Images, but cropping an image watermark into an inscribed circle is not allowed. When resizing an image watermark, you can scale it to a specific percentage of the original image size.
Table 1 describes the image watermark parameters.
Parameter |
Value Description |
Code Example |
---|---|---|
image |
Mandatory. It indicates the watermark image path. The watermark image path is bucketName/objectName (encoding required) or bucketName/objectName?x-image-process=image/command (encoding required).
NOTICE:
The content must be URL-safe Base64 encoded in the encodedObject = url_safe_base64_encode(object) format. 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 |
It indicates the percentage of the original image the image watermark will be scaled to. The value ranges from 1 to 100.
NOTICE:
P used here for resizing is case-sensitive. To adjust the size of an image watermark, see Resizing Images (except the p parameter). |
image-demo/logo.png?x-image-process=image/resize,P_50 |
Examples of Making API Calls
- Use the watermark image logo.png (path: hw-image-demo/logo.png) and make the image watermark located at the bottom right, with a transparency of 90 and default horizontal and vertical margins of 10.
Relevant parameters:
Watermark image: hw-image-demo/logo.png
Safe Base64 code: aHctaW1hZ2UtZGVtby9sb2dvLnBuZw==
Watermark position (bottom right): g_br
Transparency: t_90
Horizontal and vertical margins: x_10,y_10
Request URL:
Figure 1 Example 1
- Use the watermark image logo.png (path: hw-image-demo/logo.png) and resize the image watermark by setting its width to 50. Keep other parameters the same as those in the previous example.
Relevant parameters:
Watermark image: hw-image-demo/logo.png?x-image-process=image/resize,w_50
Safe Base64 code: aHctaW1hZ2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb2Nlc3M9aW1hZ2UvcmVzaXplLHdfNTA=
Watermark position (bottom right): g_br
Transparency: t_90
Horizontal and vertical margins: x_10,y_10
Request URL:
Figure 2 Example 2
- Use the watermark image logo.png (path: hw-image-demo/logo.png) and resize the image watermark to 50 percent of the original image's size. Keep other parameters the same as those in the previous example.
Relevant parameters:
Watermark image: hw-image-demo/logo.png?x-image-process=image/resize,P_50
Safe Base64 code: aHctaW1hZ2UtZGVtby9sb2dvLnBuZz94LWltYWdlLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfNTA=
Watermark position (bottom right): g_br
Transparency: t_90
Horizontal and vertical margins: x_10,y_10
Request URL:
Figure 3 Example 3
Example of Using GUI
To add an image watermark to an image, you can create a watermark style on OBS Console and then apply it to the image. The following gives an example of creating a watermark style on OBS Console:
- Log in to OBS Console and click the required bucket name. In the navigation pane, choose Data Processing > Image Processing.
- Click Create to go to the style editing page
- On the editing page, specify a style name, choose GUI for Edit Mode, and click Watermark.
A style name consists of letters (uppercase or lowercase), digits, periods (.), underscores (_), and hyphens (-) and contains 1 to 256 characters, for example, rotate_0001.
- 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, as shown in .
- Vertical Margin: Retain the default value 10.
- Horizontal Margin: Retain the default value 10.
- 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 Using the Image Style.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot