Skip to content
Menu
Auto
English
GitHub
Auto
English

Recipe documents

@image-marker/recipe@0.1 is the platform-neutral contract for the Image Marker toolchain. It contains the Recipe v2 schema, validation, migration, template resolution, serialization, and immutable layer operations. It has no React, React Native, browser, or renderer dependency.

Terminal window
npm install @image-marker/recipe@^0.1
import {
createWatermarkRecipeDefinition,
materializeWatermarkRecipe,
serializeWatermarkRecipe,
} from '@image-marker/recipe';
const recipe = createWatermarkRecipeDefinition({
layers: [
{
id: 'recipient',
type: 'text',
text: 'Prepared for {{name}}',
style: { fontSize: 32, color: '#FFFFFF' },
},
],
output: { saveFormat: 'png' },
});
const resolved = materializeWatermarkRecipe(recipe, {
variables: { name: 'Alice' },
});
const json = serializeWatermarkRecipe(resolved);

The same JSON can be edited by Editor, rendered on a device by Core, rendered on a server by Node, or processed in automation by the CLI.

  • Set schemaVersion: 2 for persisted documents.
  • Give every layer a stable, unique id.
  • Keep output settings under output.
  • Use placeholders such as {{name}}, {{index}}, and {{filename}}.
  • Validate untrusted JSON and explicitly migrate supported v1 documents.
  • Persist the Recipe, not an Editor controller snapshot or renderer state.

The published JSON Schema is available as @image-marker/recipe/schema.json. Core, Editor, and Node also expose the shared Recipe types where that keeps application imports convenient.