As its name implies the Image Metadata Plugin provides methods to access metadata in image files during a Maven build process.

Currently (1.0.0) the plugin only supports writing metadata to images. It is meant primarily to be used with generated or exported imagery, which often lacks metadata such as author name, description, or copyright information. The plugin helps publishing these images by injecting such metadata into the files.

Usage

The goal set-simple-metadata injects a minimal set of metadata items into image files, which means:

  • creator or artist name
  • description
  • descriptive keywords
  • copyright notice
  • URL to full copyright license

    These items can be specified as default values or as image-specific values. Specific values override default values.

    An example with a mixture of default and specific metadata items:

    ...
      <plugin>
        <groupId>de.textmulch</groupId>
        <artifactId>image-metadata-plugin</artifactId>
        <executions>
          <execution>
            <id>metadata simple</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>set-simple-metadata</goal>
            </goals>
            <configuration>
                <defaultCreator>Mr. Example</defaultCreator>
                <defaultCopyrightText>This work is licensed under the Creative Commons ...</defaultCopyrightText>
                <defaultCopyrightUrl>http://creativecommons.org/licenses/by/3.0/de/</defaultCopyrightUrl>
                <images>
                    <image>
                        <file>media/a1.png</file>
                        <description>A test image with two boxes and an arrow.</description>
                        <keywords>test, box, arrow</keywords>
                    </image>
                    <image>
                        ...
                </images>
            </configuration>
          </execution>
        </executions>
      </plugin>
      ...

    The information in the default... tags is used for every image without a specific equivalent. These default settings are typically used with static information, like the name and copyright license. Settings like descriptions vary almost always.

    Tag names for default and specific settings
    MeaningDefaultSpecific
    image file namen/afile
    creator namedefaultCreatorcreator
    descriptiondefaultDescriptiondescription
    keywordsdefaultKeywordskeywords
    copyright noticedefaultCopyrightTextcopyrightText
    copyright URLdefaultCopyrightUrlcopyrightUrl

Input

The input image files are specified in a file tag, containing the path and and file name of the image. Input images will not be modified by this goal.

Output

During processing the input images are copied to the directory specified in outputDirectory. The output directory defaults to target/generated-resources.

Requirements

ExifTool

This plugin uses Phil Harvey's ExifTool. Since ExifTool is a Perl library and command-line application, it must be installed separately. The exiftool command-line application must be available in the PATH.

im4java

This plugin uses the im4java library as a dependency. See here for their repository information.

Limitations

Currently the plugin can process only the image formats supported by ExifTool (mostly bitmap files), see here for a list.