watermark

Draw text overlay on image.

The font that is passed as a parameter must exists on the Wedia Server.

To list the available fonts you can use this admin endpoint : /admin/imagingserver/server.jsp

The output of installed fonts on the server

parameters

  • location: gravity value, default location of the overlay

  • location coordinates: dimension values (x and y), location of the overlay

  • font: font of overlay text

  • angle: angle of overlay

  • stroke width: width of strokes

  • shade: shade parameter, for font shade effect

  • thicker outline mode: thickeroutline parameter, while true, clear the inner part of the outline

  • overlay: the overlay text

  • text decorations: text decoration parameter, overlay text decoration

  • colors: overlay colors

  • 2021.6 take into account image density to compute font size relatively to the image height (if false (default), a standard resolution of 96 DPI is used)

JSON object properties

  • background: background color of overlay

  • foreground (or color): foreground color of overlay

  • outline (or color): color of the outline

  • gravity: location of the overlay

  • x: x (easting) coordinates of the overlay

  • y: y (northing) coordinates of the overlay

  • underline: text decoration

  • font: font description, font for overlay text

  • stroke: parameter value, stroke width

  • angle: rotation angle of the overlay

  • thickeroutline: thicker outline mode

  • overlay: a text overlay

  • 2021.6 tiad: true to take into account the image density for font size

 

overlay as a simple value

the value is the text

Example

{ "watermark": { "font": ["Arial",48,"italic"], "overlay": "Hello!" } }

 

Maldives: W400×H225

Maldives: W400×H225

overlay could be an array of values (strings, numbers…​)

Group all the texts into one, as lines separated with carriage return.

Example

{ "watermark": { "font": ["Arial",48], "overlay": ["Hello!",2018,"Welcome!"] } }

Maldives: W400×H225

Maldives: W400×H225

simplified syntax parameters

  • prefix f: font

  • prefix bg: background color

  • prefix fg: foreground color

  • prefix sc: stroke color

  • prefix g: location

  • prefix x: x (easting) coordinates

  • prefix y: y (northing) coordinates

  • prefix a: angle

  • prefix s: stroke width

  • prefix tx: text

  • prefix xd: text decoration

  • prefix sh: shade

  • switch thickeroutline: increases the thickness of outlines

  • switch tiad: take into account density to compute font size

array type parameters

The first element in the array is always the overlay. Other parameters can be put in any order.

Example

{ "watermark": [["Hello!","Welcome!"],"center","Arial|48|Italic","Underline",["dodgerblue","black"],"-30°"] }

Maldives: W400×H225

Maldives: W400×H225

string or number type parameters

The text to draw. All other parameters are defaults.

Example 1 - Simple text

Maldives: W400×H225

Maldives: W400×H225

Simplified syntax: tx_"\u00a9Wedia",f_Candice|25%|bold,c_watermark

Example 2 - Colored text

Maldives: W400×H225

Maldives: W400×H225

Simplified syntax: tx_"\u00a9Wedia",f_Montserrat|25p|bold,fg_#00A5C8,c_watermark

Example 3 - Outlined text

Maldives: W400×H225

Maldives: W400×H225

Simplified syntax: tx_"\u00a9Wedia",f_Montserrat|50p|heavy,sc_white,fg_none,g_center,c_watermark

Example 4 - Outlined text, blur effect

Maldives: W400×H225

Maldives: W400×H225

Simplified syntax: tx_"\u00a9Wedia",f_Montserrat|50p|heavy,sc_white,fg_$blur:25x25,g_center,c_watermark

Example 5 - Outlined text, shade effect

 

Maldives: W400×H225

Maldives: W400×H225

Simplified syntax: tx_"\u00a9Wedia",f_Montserrat|50p|heavy,sc_white,fg_$blur:25x25,sh_45x90,g_center,c_watermark

Example 6 - With or without thickeroutline

Without thickeroutline:

 

Maldives: W400×H225

Maldives: W400×H225

With thickeroutline:

Maldives: W400×H225

Maldives: W400×H225

Using variables in overlay text

The text can includes some variable parts with the syntaxe ${variable name}. The variable name can be:

a property of the object (or a property of the linked object (only single child) using the dotted notation).

Maldives: W400×H225

Maldives: W400×H225

a property of the original resource image

Maldives: W400×H225

Maldives: W400×H225

a property of the previous resource image

Maldives: W400×H225

Maldives: W300×H168

a parameter from the request

with

Maldives: W400×H225

Maldives: W400×H225