Metadata Read/Write Mapping
From ResourceSpace Documentation Wiki
Contents |
ResourceSpace's Metadata Support with ExifTool
In ResourceSpace versions 1.5 and above, Exiftool can be used to read and write metadata. This is extremely flexible and any metadata present in a file can be mapped to ResourceSpace fields. Many different profiles are supported in addition to Exif, including XMP, IPTC, GPS, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3.
The method is highly unique and flexible, yet quite simple in concept. It features:
- the security of knowing that your original assets will always be left untouched, in case metadata writing corrupts a file (which can happen any time a file is modified). The metadata write happens upon download, so if the downloaded file is corrupt, the original asset is still accessible.
- Exiftool, which efficiently reads an enormous quantity of tags from all kinds of files, and writes to many formats.
- The ability to map any tag in a file to any ResourceSpace field.
- The ability to map multiple tags to the same ResourceSpace field. So, for example, you have a few places to pick up a Caption depending on different files you have, and ResourceSpace will attempt to level the field by writing its extracted info to all of those tags upon download.
- Different Resource Types can have different mapping strategies.
- A metadata report gives a full exiftool report on the original file, showing all possible metadata that could have been indexed, sorted by metadata type (IPTC,XMP,EXIF, etc). It also shows which tags are mapped to which RS fields, and a diff report showing how any tags have been subsequently modified in ResourceSpace fields (which gives an indication of how the file will be modified on download).
- ResourceSpace fields can be mapped to custom XMP panel tags. With a modification of the exiftool config file, it can also write to those fields.
Working with Exiftool
You must have Exiftool (a command-line interface to a PERL library) installed and enabled (the path must be specified) in config.php or auto-detected during the setup routine.
In order to map an IPTC/Exif/XMP tag name to a ResourceSpace field, you can enter ExifTool-supported tag name(s) in the "Exiftool_Field" box in Resource Types/Fields.
Here are some example mappings. Your default installation will probably have these and more already set up. :
| RS Field | Exiftool_field Tags |
|---|---|
| Title | Title |
| Keywords | Keywords |
| Caption | Caption-Abstract,Description,ImageDescription |
| Country | Category,Country |
| Named Persons | People |
| Rating | Rating |
| Credit | Source,Creator,Credit,By-line |
| Camera Make/Model | Model |
| Notes | JobID |
See ExifTool documentation to look up tag names. It fully supports read/writing of several filetypes including JPG, GIF, PNG, TIF, EPS, PDF. It can also read data from other filetypes that are not write-supported.
http://www.sno.phy.queensu.ca/~phil/exiftool/#features
http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html <--good documentation of command-line capabilities
Download ExifTool Man Page in PDF Format
Remember that any individual field may not be available for a particular filetype. For example JobID will not write to a PDF file. If you need "Notes" to be written to PDF files, you will have to find a PDF-writable field in addition to JobID. The reason for using multiple fields is that certain programs look for information in a specific place. For example if Photoshop gets the caption from Caption-Abstract and another program you use gets it from ImageDescription, you need to have your RS caption in both. It may take some experimentation to get the combination that best suits your workflow.
Of course you can also create your own custom fields and mappings. Let's say you want a weblink to be embedded in the metadata of your images. You simply create an RS field called something like "URL" and in the Exiftool_field you write "WebStatement", which is a field you've found in ExifTool's list of writeable fields that is most appropriate for that kind of data.
Here is another possibility for special tweaking of Exiftool. You can set up custom panels and XMP namespaces in Adobe programs to create any kind of selections or fields you want. These will import into ResourceSpace. If you define your custom namespace/tags in the exiftool config file, you can also write to those fields from ResourceSpace. http://owl.phy.queensu.ca/~phil/exiftool/config.html
- As of r1456 (version numbers greater than *.*.1456) it is possible to enter the group followed by a colon then the field name, if you need to be specific to a particular metadata group (for example JFIF:XRESOLUTION).
- As of r739, Resource Type is recognized by the Exiftool feature. This means, for example, that Video Type resources will not extract or write Photo Type or Document Type fields. Exiftool operations and reports are limited to Global Fields and Fields of the current resource type.
- Date reading and writing of RS date fields works now, but time storage needs some more thought. Now, date is preserved but times are truncated.
Metadata Reference Materials
http://www.metadataworkinggroup.org/specs/ standards on working with metadata
http://www.adobe.com/devnet/xmp/ custom file info panels
http://www.prismstandard.org/recordedwebinars09/xmpwebinars.htm xmp presentations
Metadata Report
New feature, in development, in subversion r736, if you set $metadata_report to true, the ability to run a full metadata report is added to the View page. This can help you find useful information embedded in the original files, or help generate a mapping strategy.
It shows:
- all metadata in the original file, by the exiftool name.
- which fields have been mapped to RS and extracted
- which fields have been subsequently changed in RS.
- it also hints at the read/writability of fields.
In short, it shows any RS mapping that intersects with current embedded metadata.
It does not show RS mappings that may write *new* previously-non-existent tags to the file. It simply focuses on what existing information is being extracted and which of that info may be affected by the attempted metadata-write upon download.
Exiftool versions less than 7.47 will not give accurate feedback about the writability of particular file formats (only tags in general). v7.47 and above will allow the report to omit suggestions that tags are writable if the file itself is not writable.
Mapping Exif / IPTC without ExifTool
If you have not installed ExifTool, ResourceSpace supports the reading of some basic Exif fields and all IPTC fields when resources are uploading. For anything other than the most basic metadata support it is best to use ExifTool as described above.
Without ExifTool, ResourceSpace will not write altered metadata back to files on download.
Exif fields are mapped using the $exif_* settings in include/config.php.
IPTC fields are mapped using the 'IPTC Equiv.' option on each field in System Setup. The codes you need are as follows:
| IPTC Equiv. value | Metadata field extracted |
|---|---|
| 2#120 | Caption |
| 2#025 | Keywords |
| 2#055 | Creation Date |
| 2#040 | Special Instructions |
| 2#085 | Credit Byline Title |
| 2#101 | Country |
| 2#105 | Headline |
| 2#110 | Source |
| 2#115 | Photo Source |
| 2#120 | Caption |
| 2#090 | City |
| 2#095 | State |
