@contentauth/c2pa-node 0.12.3
    Preparing search index...

    Interface TrustmarkInterface

    interface TrustmarkInterface {
        decode(image: Buffer): Promise<string>;
        encode(
            image: Buffer,
            strength: number,
            watermark?: string,
        ): Promise<Buffer>;
        remove(image: Buffer): Promise<Buffer>;
    }

    Implemented by

    Index

    Methods

    • 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>

    • 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

      • Optionalwatermark: string

        optional bitstring to be encoded, automatically generated if not provided

      Returns Promise<Buffer>

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

    • Remove a P/Q watermark using the separately loaded removal model. Requires loadRemover: true; rejects unsupported input and removal failures. Removal is lossy, may change unwatermarked images, and does not guarantee restoration of original pixels or removal of arbitrary watermarks. Rejects inputs exceeding 64 MiB, 16,384 pixels per dimension, or 32 million pixels. Decoding has a best-effort 128 MiB allocation budget; limits are per call, not a cap on total process memory. Image metadata (EXIF, XMP, ICC profiles, and C2PA manifests) is not copied. Existing credentials do not remain valid for the modified pixels; sign a new manifest to attach valid Content Credentials to the output.

      Parameters

      • image: Buffer

        An 8-bit JPEG or PNG (RGB, RGBA, or grayscale)

      Returns Promise<Buffer>

      Encoded PNG preserving dimensions and alpha, not raw pixel data