Raster Image - Watermark
From RealWorld Wiki
The Watermark operation is an operation plug-in, which works with raster images and adds a specified image or a text to the original image.
The placement of the added object is specified in percents. Setting the values to 0% will put the watermark in top/left corner while setting it to 100% will place it in the bottom/right corner. It is also possible to add a margin (specified in pixels) to the object and the margin is considered part of the object changing its native size.
The watermark can be either text or image. In any case it is possible to set a master transparency value. If the watermark is to be an image, it is necessary to specify a full path that image in the configuration. In case of text watermark, there are many more options.
Text watermarks use selected font, they can be italic and/or bold and shadow can be placed under the text to make it more legible (the shadow will be either balkc or white depending on the color of the letters). The text can also be rotated by any angle in range -180 to 180 degrees. Finally, the size of the used font can either be specified in pixels or it may be automatically computed as percentage of the image size.
The watermarked text can consist of multiple lines with given alignment and the placeholders can be used:
- %% - prints a single % sign
- %FILENAME% - name of the processed image without extension ("filename" if unavailable)
- %FILEFOLDER% - path to the folder with processed image with trailing / ("folder/" if unavailable)
- %FILEEXT% - extension of the processed image ("ext" if unavailable)
- %FILEPATH% - full path (including folder, name and extenaison) to the processed image ("fullpath" if unavailable)
- %EXIF-TagName% - value of an EXIF tag as text (empty string if tag is unavailable); for example using %EXIF-Model% will print the name of the digital camera used to shoot the image, for example "NIKON D50".
If more flexibility is needed, it is possible to used the JavaScript operation and call the Watermark filter from there with parameters computed on the fly.
[edit] Internals
GUID: B840563F-6365-40EB-9438-1F84DB5B808F
| Parameter name | Type | Default | Value | Note |
|---|---|---|---|---|
| PosX | integer | 100 | 0-100% | horizontal position |
| PosY | integer | 100 | 0-100% | vertical position |
| Margins | integer | 10 | pixels | |
| Opacity | integer | 100 | 0-100% | 0=completely transparent |
| Type | integer | 0 | 0=text, 1=image | |
| Image | string | "" | path to the watermark image | only used if Type is 1 |
| Text | string | "%FILENAME%" | only used if Type is 0 | |
| Font | string | "Arial" | only used if Type is 0 | |
| Color | integer | 0x68e0e8 | RGB in 8bit hexadecimal (web) format | only used if Type is 0 |
| Bold | bool | false | only used if Type is 0 | |
| Italic | bool | false | only used if Type is 0 | |
| Shadow | bool | false | only used if Type is 0 | |
| Angle | integer | 0 | -180 to 180 degrees | only used if Type is 0 |
| Alignment | integer | 2 | 0=left, 1=center, 2=right | only used if Type is 0 |
| SizeType | integer | 0 | 0=absolute, 1=relative | only used if Type is 0 |
| AbsSize | integer | 16 | pixels | only used if Type is 0 and SizeType is 0 |
| RelSize | float | 2.0 | % | only used if Type is 0 and SizeType is 1 |
