This plugin allows you to scale images to a maximum size and then render watermarks into the previously scaled images. The maximum size and the watermark to be rendered can be configured flexibly.
GPL 2.0 or newer
Goobi workflow 2020.06
To install the plugin, the following file must be installed:
A configuration file is also required to run the plugin correctly:
Furthermore, a successful installation of the following two packages is also required on the system:
Both packages are included in common package managers and can be easily installed from them.
The configuration of the plugin allows you to define the maximum size of the images and the watermark (images and text watermarks are supported). Also the positioning of the watermark can be defined individually. Several configurations are possible for this purpose, which are differentiated by the project, the name for the work step within the workflow, the digital collection as well as a media type (special metadata within the METS file of the respective process). When the plugin is executed, the first configuration that matches the currently processed task is used.
Please note that the correct paths for GraphicMagick and ImageMagick must also be specified at the top of the configuration.
An example configuration for the file
plugin_intranda_step_image_resize_and_watermark.xml looks like this:
<config_plugin><!-- path to GraphicsMagick --><gmPath>/usr/bin/gm</gmPath><!-- path to ImageMagick --><convertPath>/usr/bin/convert</convertPath><!--order of configuration is:1.) project name and step name matches2.) step name matches and project is *3.) project name matches and step name is *4.) project name and step name are *--><config><!-- which projects to use for (can be more than one, otherwise use *) --><project>*</project><step>*</step><!-- the source directory from which the images will be taken --><sourceDir>cropped</sourceDir><!-- the destination directory where the scaled and watermarked images will reside --><destDir>media</destDir><!-- only use this block with processes in collection "mycollection"and with mediaType "book" --><imageConfig collection="mycollection" mediaType="book"><!-- The maximum size of the longest side of an image --><resizeTo>1500</resizeTo><!-- The watermark configuration --><watermark><!-- the image to use for watermarking --><image>/opt/digiverso/goobi/xslt/logo.png</image><!-- define the shade size here --><shadeSize>240x40</shadeSize><!-- the location of the watermark. Possible values: north,northeast, east, southeast, south, southwest,west, northwest --><location>southeast</location><!-- these are the distances to the edges on the x- resp. y-axis --><xDistance>100</xDistance><yDistance>100</yDistance></watermark></imageConfig><!-- use this block with processes in collection "myothercollection"and any mediaType --><imageConfig collection="myothercollection" mediaType="*"><resizeTo>1500</resizeTo><watermark><!-- you can also use a text-only watermark. --><text>My watermark text</text><!-- define the shade size here --><shadeSize>240x40</shadeSize><!-- define the size of the box for the text --><boxSize>450x200</boxSize><!-- font to use for the text rendering --><font>Open-Sans</font><location>southeast</location><xDistance>600</xDistance><yDistance>100</yDistance></watermark></imageConfig></config></config_plugin>
<config> can occur repeatedly for different projects or workflow steps in order to be able to carry out different actions within different workflows. The other parameters within this configuration file have the following meanings:
Path to install GraphicsMagick
Path to install ImageMagick
This parameter defines the project for which the current block
This parameter controls for which work steps the block
Path to the directory to be used as the source directory.
Path to the directory in which the scaled and watermarked images are to be saved.
Restriction to operations whose metadata of type
Restriction to the operations that belong to a selected digital collection.
Maximum size of the image on the longest side. Specified in pixels.
Path to an image to be used within the watermark.
Define here which size specification should be used as shade.
Text to be used within the watermark.
Specify here which font should be used for the text. This font must be installed on the system.
Define here what dimensions the box should have within which the text is to be rendered. This thus determines the size of the displayed font.
Determines where within the image the watermark should be rendered. Possible specifications are
Lateral distance of the watermark
Distance of the watermark up or down
To use the plug-in, it must be activated for one or more desired tasks in the workflow. This is done by selecting the plugin
intranda_step_image_resize_and_watermark from the list of installed plugins.
After running the plugin the images have the expected size and have the configured watermark.