PageSourceSearch

https://opensource.contentauthenticity.org/assets/js/a3d91c2a.1cbf47b8.js

js contentauthenticity.org collected 2026-09-24 08:25:45 UTC 9,007 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkopensource_contentauth_org=globalThis.webpackChunkopensource_contentauth_org||[]).push([[5609],{2698:(e,r,d)=>{d.r(r),d.d(r,{assets:()=>o,contentTitle:()=>i,default:()=>h,frontMatter:()=>c,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"sdk-repos/trustmark/rust/crates/trustmark-cli/README","title":"TrustMark CLI","description":"The Rust implementation includes a CLI wrapper for the trustmark crate.","source":"@site/docs/sdk-repos/trustmark/rust/crates/trustmark-cli/README.md","sourceDirName":"sdk-repos/trustmark/rust/crates/trustmark-cli","slug":"/sdk-repos/trustmark/rust/crates/trustmark-cli/","permalink":"/docs/sdk-repos/trustmark/rust/crates/trustmark-cli/","draft":false,"unlisted":false,"editUrl":"https://github.com/adobe/trustmark/edit/main/rust/crates/trustmark-cli/README.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Rust implementation","permalink":"/docs/sdk-repos/trustmark/rust/"},"next":{"title":"FAQ","permalink":"/docs/durable-cr/tm-faq"}}');var n=d(4848),s=d(8453);const c={},i="TrustMark CLI",o={},a=[{value:"Installation",id:"installation",level:2},{value:"Downloading models",id:"downloading-models",level:3},{value:"Usage",id:"usage",level:2},{value:"Encoding watermarks",id:"encoding-watermarks",level:3},{value:"Decoding watermarks",id:"decoding-watermarks",level:3},{value:"Examples",id:"examples",level:2}];function l(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.header,{children:(0,n.jsx)(r.h1,{id:"trustmark-cli",children:"TrustMark CLI"})}),"\n",(0,n.jsxs)(r.p,{children:["The Rust implementation includes a CLI wrapper for the ",(0,n.jsx)(r.code,{children:"trustmark"})," crate."]}),"\n",(0,n.jsx)(r.h2,{id:"installation",children:"Installation"}),"\n",(0,n.jsxs)(r.p,{children:["To install the CLI, run this command from the ",(0,n.jsx)(r.code,{children:"trustmark/crates/trustmark-cli"})," directory:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"cargo install --locked --path .\n"})}),"\n",(0,n.jsx)(r.h3,{id:"downloading-models",children:"Downloading models"}),"\n",(0,n.jsxs)(r.p,{children:["To use the CLI, you must first create a ",(0,n.jsx)(r.code,{children:"models"})," directory and download the models, ",(0,n.jsx)(r.a,{href:"/docs/sdk-repos/trustmark/rust/#download-models",children:"if you haven't already done so"}),". Enter these commands from the ",(0,n.jsx)(r.code,{children:"trustmark/rust"})," directory:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"mkdir models\ncargo xtask fetch-models\n"})}),"\n",(0,n.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,n.jsx)(r.p,{children:"View CLI help information by entering this command:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"trustmark [encode | decode] help\n"})}),"\n",(0,n.jsx)(r.p,{children:"The basic command syntax is:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"trustmark --models <MODELS> [encode | decode]\n"})}),"\n",(0,n.jsxs)(r.p,{children:["Where ",(0,n.jsx)(r.code,{children:"<MODELS>"})," is the relative path to the directory containing models.\nUse the ",(0,n.jsx)(r.code,{children:"encode"})," subcommand to encode a watermark into an image and the ",(0,n.jsx)(r.code,{children:"decode"})," subcommand to decode a watermark from an image."]}),"\n",(0,n.jsx)(r.h3,{id:"encoding-watermarks",children:"Encoding watermarks"}),"\n",(0,n.jsxs)(r.p,{children:["To encode a watermark into an image, use the ",(0,n.jsx)(r.code,{children:"encode"})," subcommand:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"trustmark --models <MODELS> encode [OPTIONS] -i <INPUT> -o <OUTPUT>\n"})}),"\n",(0,n.jsx)(r.p,{children:"Options:"}),"\n",(0,n.jsxs)(r.table,{children:[(0,n.jsx)(r.thead,{children:(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.th,{children:"Option"}),(0,n.jsx)(r.th,{children:"Description"}),(0,n.jsx)(r.th,{children:"Allowed Values"})]})}),(0,n.jsxs)(r.tbody,{children:[(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-i <INPUT>"})}),(0,n.jsx)(r.td,{children:"Path to the image to encode."}),(0,n.jsx)(r.td,{children:"Relative file path."})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-o <OUTPUT>"})}),(0,n.jsx)(r.td,{children:"Path to file in which to save the watermarked image."}),(0,n.jsx)(r.td,{children:"Relative file path."})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-w, --watermark <WATERMARK>"})}),(0,n.jsx)(r.td,{children:"The watermark (payload) to encode."}),(0,n.jsxs)(r.td,{children:["Any a binary string such as  ",(0,n.jsx)(r.code,{children:"0101010101"}),". Only 0 and 1 characters are allowed. Maximum length is governed by the version selected.  Default is a random binary string."]})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"--version <VERSION>"})}),(0,n.jsx)(r.td,{children:"The BCH version to encode with."}),(0,n.jsxs)(r.td,{children:["One of ",(0,n.jsx)(r.code,{children:"BCH_SUPER"})," (default), ",(0,n.jsx)(r.code,{children:"BCH_5"}),", ",(0,n.jsx)(r.code,{children:"BCH_4"}),", or ",(0,n.jsx)(r.code,{children:"BCH_3"}),"."]})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"--variant <VARIANT>"})}),(0,n.jsx)(r.td,{children:"The model variant to encode with."}),(0,n.jsxs)(r.td,{children:[(0,n.jsx)(r.code,{children:"Q"})," (default), ",(0,n.jsx)(r.code,{children:"B"}),", ",(0,n.jsx)(r.code,{children:"C"}),", and ",(0,n.jsx)(r.code,{children:"P"}),"."]})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"--quality <QUALITY>"})}),(0,n.jsx)(r.td,{children:"If the requested output format is JPEG, the output quality to encode."}),(0,n.jsx)(r.td,{children:"A number between 0 and 100. The default is 90."})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-h, --help"})}),(0,n.jsx)(r.td,{children:"Display help information."}),(0,n.jsx)(r.td,{children:"N/A"})]})]})]}),"\n",(0,n.jsx)(r.h3,{id:"decoding-watermarks",children:"Decoding watermarks"}),"\n",(0,n.jsxs)(r.p,{children:["To decode a watermark from an image, use the ",(0,n.jsx)(r.code,{children:"decode"})," subcommand:"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"trustmark --models <MODELS> decode [OPTIONS] -i <INPUT>\n"})}),"\n",(0,n.jsxs)(r.table,{children:[(0,n.jsx)(r.thead,{children:(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.th,{children:"Option"}),(0,n.jsx)(r.th,{children:"Description"}),(0,n.jsx)(r.th,{children:"Allowed Values"})]})}),(0,n.jsxs)(r.tbody,{children:[(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-i <INPUT>"})}),(0,n.jsx)(r.td,{children:"Path to the image to decode."}),(0,n.jsx)(r.td,{children:"Relative file path."})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"--variant <VARIANT>"})}),(0,n.jsx)(r.td,{children:"The model variant to decode with.  Must match variant used to encode the watermark."}),(0,n.jsxs)(r.td,{children:[(0,n.jsx)(r.code,{children:"Q"})," (default), ",(0,n.jsx)(r.code,{children:"B"}),", ",(0,n.jsx)(r.code,{children:"C"}),", and ",(0,n.jsx)(r.code,{children:"P"}),"."]})]}),(0,n.jsxs)(r.tr,{children:[(0,n.jsx)(r.td,{children:(0,n.jsx)(r.code,{children:"-h, --help"})}),(0,n.jsx)(r.td,{children:"Display help information."}),(0,n.jsx)(r.td,{children:"N/A"})]})]})]}),"\n",(0,n.jsx)(r.h2,{id:"examples",children:"Examples"}),"\n",(0,n.jsx)(r.p,{children:"To encode a watermark into one of the sample images, run this command from the workspace root:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-sh",children:"trustmark -m ./models encode -i ../images/ghost.png -o ../images/ghost_encoded.png\n"})}
1),"\n",(0,n.jsx)(r.p,{children:"Then to decode the watermark from this image, run this command from the workspace root:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-sh",children:"trustmark -m ./models decode -i ../images/ghost_encoded.png\n"})}),"\n",(0,n.jsx)(r.p,{children:"You'll see something like this in your terminal:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{children:"Found watermark: 0101111001101001000000011011010100100010011101101101000001101\n"})})]})}function h(e={}){const{wrapper:r}={...(0,s.R)(),...e.components};return r?(0,n.jsx)(r,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},8453:(e,r,d)=>{d.d(r,{R:()=>c,x:()=>i});var t=d(6540);const n={},s=t.createContext(n);function c(e){const r=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:c(e.components),t.createElement(s.Provider,{value:r},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.