#------------------------------------------------------------------------------
# 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 (NewMieTag1) 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 => '$val[0] =~ /(.*)\./ ? $1 : $val[0]',
        },
        # the following examples demonstrate simplifications which may be
        # used if only one tag is Require'd or Desire'd:
        # 1) the Require/Desire lookup may be replaced with a simple tag name
        # 2) "$val" may be used to represent "$val[0]" in the expression
        Extension => {
            Require => 'FileName',
            ValueConv => '$val=~/\.([^.]*)$/; $1',
        },
        # override CircleOfConfusion tag to use D/1750 instead of D/1440
        CircleOfConfusion => {
            Require => 'ScaleFactor35efl',
            ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
            PrintConv => 'sprintf("%.3f mm",$val)',
        },
        # define a tag to customize my lens names
        MyLens => {
            Description => 'Lens Type',
            Desire => {
                0 => 'LensID',
                1 => 'LensType',
                2 => 'Lens',
            },
            ValueConv => q{
                foreach (@prt) {
                    next if not defined $_ or /Unknown/;
                    return 'SIGMA 10-20mm F4-5.6 EX DC' if /various SIGMA/;
                    return $_;
                }
                return undef;
            },
        },
    },
);

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