Help Center> Data Security Center> API Reference> API Description> Image Watermarking> Extracting Dark Watermarks from Images (Image Addresses)
Updated on 2024-05-27 GMT+08:00

Extracting Dark Watermarks from Images (Image Addresses)

Function

This API is used to extract invisible text watermarks from an image whose storage address is specified (only a Huawei Cloudcloud service OBS path is supported). The supported image formats include .jpg, .jpeg, .jpe, .png, .bmp, .dib, .rle, .tiff, .tif, .ppm, .webp, .tga, .tpic, and .gif.

URI

POST /v1/{project_id}/image-address/watermark/extract

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

region_id

Yes

String

ID of the region where the project is located, for example, xx-xx-1.

src_file

Yes

String

Address of the image from which the text watermark is to be extracted. Currently, only Huawei Cloudcloud service OBS objects are supported. The format is obs://bucket/object, where bucket indicates the name of the OBS bucket in the same region as the current project, and object indicates the full path name of the object. For example, obs://hwbucket/hwinfo/hw.png, where obs:// indicates OBS, hwbucket indicates the bucket name, and hwinfo/hw.png indicates the full path name of the object.

mark_len

No

Integer

Length of the watermark to be extracted. The value ranges from 0 to 32. This parameter improves watermark extraction performance.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

watermark

String

Invisible watermark. The length cannot exceed 32 characters.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error Message

Example Requests

Extract the invisible text watermarks from the image at obs://hwbucket/hwinfo/hw.png.

POST /v1/{project_id}/image-address/watermark/extract HTTP/1.1

{
  "region_id" : "xx-xx-1",
  "src_file" : "obs://hwbucket/hwinfo/hw.png"
}

Example Responses

Status code: 200

Request succeeded.

{
  "watermark" : "mark!"
}

Status code: 400

Invalid request

{
  "error_code" : "DSC.00000007 ",
  "error_msg" : "File format error"
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request

Error Codes

See Error Codes.