ImageMetadata

From The Battle for Wesnoth Wiki

Image Metadata

Author and copyright data of Wesnoth images are contained in the image metadata. For most of Wesnoth's project history, image authorship and copyrights were tracked in a separate text document. Such a document can still be generated from the metadata, but is not currently (2025) part of the commit process. There is no expectation that an artist correctly format the metadata, but the individual committing the image to the project files is expected to do so.

A lot of different programs can manipulate metadata, and they all seem to have different ways of doing it. Exiftool is platform-independent, command-line application that has been the primary toolkit applied to Wesnoth images. More info can be found at https://www.exiftool.org/index.html

The discussion assumes GIMP (or Krita) is the image editor used, but it is probably equally valid for Adobe Photoshop. Other editors probably have some metadata support, this is a wiki.

Basic usage of exiftool

To view metadata of an image <file> grouped by tag

   exiftool -g <file>

Note: WEBP must contain "Alpha" in RIFF:WebP_Flags or else the transparent background will be lost when EXIF tags are added. Exiftool is supposed to read but not write this flag (so -all= argument shouldn't clobber it, but sometimes it does). GIMP will set this flag, but it can get removed by further processing. Viewing the image metadata with the above command will allow you to check.

To write the needed metadata (Author and Copyright) but remove all the other info injected by image editors (most of which is useful in some context, just not this one), we use -all= to clear the deck. For small PNG files, thumbnail data can double the file size, and this matters because we have a lot of these little files. We can also use -overwrite_original to prevent a backup file. Different tag groups have different names for very similar fields, and they often don't match what you see in the image editor dialogs.

  • XMP (dc "Dublin Core") tags - Used for PNG because they are most likely to be edited with GIMP (see below).
   exiftool -overwrite_original -all= -Date="<Y:m:d H:M:S>" -Rights="<copyright>" -Creator="<name (account name)>" -Description="<comment>" <target file>
  • EXIF - Used for WEBP and JPG, as Exif data seemed more visible in some file managers. We could add both XMP and Exif to all images, but that would make the files larger.
   exiftool -overwrite_original -all= -CreateDate="<Y:m:d H:M:S>" -Copyright="<copyright>" -Artist="<name (account name)>" -UserComment="<comment>" <target file>

Metadata and CI

Authorship and Copyright

To satisfy CI, image metadata is checked for a small set of entries.

For PNG files:

  • XMP:Creator must exist.
  • XMP:Rights must contain "GNU GPL v2+", "CC BY-SA 4.0", or "CC0"

For JPEG, WEBP:

  • EXIF:Artist must exist.
  • EXIF:Copyright must contain "GNU GPL v2+", "CC BY-SA 4.0", or "CC0"


Optional tags reported in CI

(This needs to be fixed, both here and CI.)

Metadata and Image Editors

GIMP (2.10)

Image->Metadata->Edit Metadata

  • PNG - Can read/write XMP:Creator, XMP:Rights, and XMP:Description under the "Description" tab
  • WEBP - Can read/write XMP:Creator, XMP:Rights, and XMP:Description under the "Description" tab
  • JPEG - Can read IPTC:By-line or EXIF:Artist (IPTC takes precedence), shown under "Description", exports to XMP and IPTC groups

Krita (5.1)

Layer->Edit Metadata...

  • PNG - Does not always import XMP:Creator or XMP:Rights, but can write to them under "Dublin Core" tab, as well as XMP:Description
  • WEBP - Does not seem to import anything, but can write XMP:Creator and XMP:Rights
  • JPEG - Can import EXIF:Artist and EXIF:Copyright, shown under "Dublin Core" as Creator & Rights, exported under IPTC:By-line and IPTC:Copyright Notice


Examples

A sprite (PNG) with the needed XMP tags is shown below.

file.php?id=99456&type=.png

Examples of WebP showing the Alpha flag issue can be found at this forum post:

https://forums.wesnoth.org/viewtopic.php?p=694451#p694451

See also

This page was last edited on 23 March 2025, at 12:16.