Go SDK

Official Go SDK for TruthMark invisible watermarking.

Installation

go get github.com/truthmark/sdk

Quick Example

package main

import (
    "fmt"
    truthmark "github.com/truthmark/sdk"
)

func main() {
    // Initialize
    client := truthmark.NewClient(nil)

    // Encode
    result, err := client.Encode("image.png", "My secret message")
    if err != nil {
        panic(err)
    }
    fmt.Printf("Download: %s\n", result.DownloadURL)

    // Decode
    decoded, err := client.Decode("watermarked.png")
    if err != nil {
        panic(err)
    }
    
    if decoded.Found {
        fmt.Printf("Message: %s\n", decoded.Message)
    }
}

API Reference

Encode(imagePath, message string)

Embed an invisible watermark into an image.

Decode(imagePath string)

Extract watermark from an image.