#------------------------------------------------------------------------------
# File:         ExifTool_config  -->  ~/.ExifTool_config
#
# Description:  Sample user configuration file for Image::ExifTool
#
# Notes:        This example file shows how to define your own shortcuts and
#               add new EXIF, IPTC, XMP, PNG, MIE and Composite tags.
#
#               Note that unknown tags may be extracted even if they aren't
#               defined, but tags must be defined to be written.  Also note
#               that it is possible to override an existing tag definition
#               with a new tag.
#
#               To activate this file, rename it to ".ExifTool_config" and
#               place it in your home directory or the exiftool application
#               directory.  This causes ExifTool to automatically load the file
#               when run.  Your home directory is determined by the first
#               defined of the following environment variables:
#
#                   1. EXIFTOOL_HOME
#                   2. HOME
#                   3. HOMEDRIVE + HOMEPATH
#                   4. (the current directory)
#
#               This sample file defines the following 11 new tags as well as a
#               number of Shortcut and Composite tags:
#
#                   1.  EXIF:NewEXIFTag
#                   2.  IPTC:NewIPTCTag
#                   3.  XMP-xxx:NewXMPxxxTag1
#                   4.  XMP-xxx:NewXMPxxxTag2
#                   5.  XMP-xxx:NewXMPxxxTag3
#                   6.  XMP-xmp:NewXMPxmpTag
#                   7.  PNG:NewPngTag1
#                   8.  PNG:NewPngTag2
#                   9.  PNG:NewPngTag3
#                  10.  MIE-Meta:NewMieTag1
#                  11.  MIE-Test:NewMieTag2
#
#               For detailed information on the definition of tag tables and
#               tag information hashes, see lib/Image/ExifTool/README.
#------------------------------------------------------------------------------

# Shortcut tags are used when extracting information to simplify
# commonly used commands.  They can be used to represent groups
# of tags, or to provide an alias for a tag name.
%Image::ExifTool::Shortcuts::UserDefined = (
    MyShortcut => ['createdate','exposuretime','aperture'],
    MyAlias => 'FocalLengthIn35mmFormat',
);

# NOTE: All tag names used in the following tables are case sensitive.

# This is a basic example of the definition for a new XMP namespace.
# After defining this table (which may have any name), a corresponding
# "SubDirectory" entry must be added to the Main XMP table through
# the %Image::ExifTool::UserDefined definition below.
%Image::ExifTool::UserDefined::xxx = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
    NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
    NewXMPxxxTag1 => { },
    NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
    NewXMPxxxTag3 => { List => 'Bag' },
);

# Adding a new MIE group requires a few extra definitions
use Image::ExifTool::MIE;
%Image::ExifTool::UserDefined::MIETest = (
    %Image::ExifTool::MIE::tableDefaults,   # default MIE table entries
    GROUPS      => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' },
    WRITE_GROUP => 'MIE-Test',
    NewMieTag2  => { },     # new user-defined tag in MIE-Test group
);

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # All EXIF tags are added to the Main table, and WriteGroup is used to
    # specify where the tag is written (default is ExifIFD if not specified):
    'Image::ExifTool::Exif::Main' => {
        0xd000 => {
            Name => 'NewEXIFTag',
            Writable => 'int16u',
            WriteGroup => 'IFD0',
        },
    },
    # IPTC tags are added to a specific record type (ie. application record):
    'Image::ExifTool::IPTC::ApplicationRecord' => {
        300 => {
            Name => 'NewIPTCTag',
            Format => 'string[0,16]',
        },
    },
    # new XMP namespaces (ie. XMP-xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        xxx => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xxx',
            },
        },
    },
    # XMP tags may also be added to existing namespaces:
    'Image::ExifTool::XMP::xmp' => {
        NewXMPxmpTag => { Groups => { 2 => 'Author' } },
    },
    # new PNG tags are added to the PNG::TextualData table:
    'Image::ExifTool::PNG::TextualData' => {
        NewPngTag1 => { },
        NewPngTag2 => { },
        NewPngTag3 => { },
    },
    # add a new MIE tag (MieTag1) and group (MIE-Test) to MIE-Meta
    # (Note: MIE group names must NOT end with a number)
    'Image::ExifTool::MIE::Meta' => {
        NewMieTag1 => {
            Writable => 'rational64u',
            Units => [ qw(cm in) ],
        },
        Test => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MIETest',
                DirName => 'MIE-Test',
            },
        },
    },
    # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique: The Require/Desire elements list
        # tags that must/may exist, and the keys of these hashes are used
        # as indices in the @val array of the ValueConv expression to
        # derive the composite tag value.  (See the Composite table in
        # Image::ExifTool::Exif for more examples.)
        BaseName => {
            Require => {
                0 => 'FileName',
            },
            # remove the extension from FileName
            ValueConv => 'my $name=$val[0]; $name=~s/\..*?$//; $name',
        },
        Extension => {
            Require => {
                0 => 'FileName',
            },
            ValueConv => '$val[0]=~/\.([^.]*)$/; $1',
        },
        # override CircleOfConfusion tag to use D/1750 instead of D/1440
        CircleOfConfusion => {
            Require => {
                0 => 'ScaleFactor35efl',
            },
            ValueConv => 'sqrt(24*24+36*36) / ($val[0] * 1750)',
            PrintConv => 'sprintf("%.3f mm",$val)',
        },
    },
);

#------------------------------------------------------------------------------
1;  #end

<-- Back to ExifTool home page