@contentauth/c2pa-node


@contentauth/c2pa-node / Trustmark

Class: Trustmark

Defined in: Trustmark.ts:21

Implements

Constructors

Constructor

new Trustmark(trustmark): Trustmark

Defined in: Trustmark.ts:22

Parameters

trustmark

unknown

Returns

Trustmark

Methods

decode()

decode(image): Promise<string>

Defined in: Trustmark.ts:42

Decode a watermark from an image.

Parameters

image

Buffer

image to extract the watermark from (must be in a supported image format like JPEG, PNG, etc.)

Returns

Promise<string>

Implementation of

TrustmarkInterface.decode


encode()

encode(image, strength, watermark?): Promise<Buffer<ArrayBufferLike>>

Defined in: Trustmark.ts:29

Encode a watermark into an image.

Parameters

image

Buffer

image to be watermarked

strength

number

number between 0 and 1 indicating how strongly the watermark should be applied

watermark?

string

optional bitstring to be encoded, automatically generated if not provided

Returns

Promise<Buffer<ArrayBufferLike>>

raw pixel data in RGB8 format (width * height * 3 bytes)

Implementation of

TrustmarkInterface.encode


newTrustmark()

static newTrustmark(config): Promise<Trustmark>

Defined in: Trustmark.ts:24

Parameters

config

TrustmarkConfig

Returns

Promise<Trustmark>