ExifTool Forum

ExifTool => The Image::ExifTool API => Topic started by: Alan Clifford on August 19, 2015, 11:46:44 AM

Title: Contents of .ExifTool_config
Post by: Alan Clifford on August 19, 2015, 11:46:44 AM
I'm at the stage of going to use the API to write the depth to my underwater photos.  Up to know, I've been reusing functions to read stuff from photos so haven't had to actually re-learn anything about the API.

Couple of questions about the config. file

When testing the config., I can


egremont:suunto-test alan$ exiftool -UWDepth=-27 f200_3292.jpg
    1 image files updated

egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G -s2
[XMP] UWDepth: -27
egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G1 -s2
[XMP-uw] UWDepth: -27
egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G2 -s2
[Location] UWDepth: -27


which looks OK

First question.  Is this .Exif_config file OK?

egremont:scripts alan$ cat ~/.ExifTool_config
# exiftool -config example.config ...

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        # date and time with timezone in xmp:datetimeoriginal
        uw => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::uw',
                # (see the definition of this table below)
            },
        },
    },


);

# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'uw', which corresponds to
# an ExifTool family 1 group name of 'XMP-uw'.
%Image::ExifTool::UserDefined::uw = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-uw', 2 => 'Location' },
    NAMESPACE => { 'uw' => 'http://xmpns.clifford.ac/uw/' },
    WRITABLE => 'string',
    UWDepth => { Writable => 'real' },
    UWAltitudeSurface => { Writable => 'real' },
    UWAltitude => { Writable => 'real' },
);




Second question.

As exiftool will read my new UWdepth without the config file, could I move the config. stuff into the Perl program that I will use to write the information?
Title: Re: Contents of .ExifTool_config
Post by: Phil Harvey on August 19, 2015, 11:51:59 AM
Quote from: Alan Clifford on August 19, 2015, 11:46:44 AM
egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G -s2
[XMP] UWDepth: -27
egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G1 -s2
[XMP-uw] UWDepth: -27
egremont:suunto-test alan$ exiftool -UWDepth f200_3292.jpg -G2 -s2
[Location] UWDepth: -27

Just FYI, you can do this:  exiftool -UWDepth f200_3292.jpg -G0:1:2 -s2

QuoteIs this .Exif_config file OK?

Looks good to me.

QuoteAs exiftool will read my new UWdepth without the config file, could I move the config. stuff into the Perl program that I will use to write the information?

Yes.  Since you are using very simple tag definitions, the only thing you won't get when reading without the config file are the family 2 groups.

- Phil
Title: Re: Contents of .ExifTool_config
Post by: Alan Clifford on August 19, 2015, 12:33:24 PM
Quote from: Phil Harvey on August 19, 2015, 11:51:59 AM

Just FYI, you can do this:  exiftool -UWDepth f200_3292.jpg -G0:1:2 -s2

I should have been able to guess that you would have implemented something like that.


QuoteAs exiftool will read my new UWdepth without the config file, could I move the config. stuff into the Perl program that I will use to write the information?
Quote
Yes.  Since you are using very simple tag definitions, the only thing you won't get when reading without the config file are the family 2 groups.

Thanks.  I'll have a go at that.
Title: Re: Contents of .ExifTool_config
Post by: Alan Clifford on August 21, 2015, 10:05:19 AM
Wrong section I suppose, but still about .ExifTool_config.

I have an old bash script that does stuff to a photograph - rotates, size, watermark.

Due to stuff such as:# jpegtran will not copy both exif and comments
# mogrify does not copy IPTC data
# jhead copying of exif seems to destroy commnents
# jhead refers to one comment whereas there can be several
# jpegexiforient seems to baulk after jpegtran copies exif
# Get this order right


most of which I don't use anymore, I copy metadata from the original file into the processed file.  Testing this with

exiftool -overwrite_original_in_place -tagsfromfile ~/photographs/temp/f200_3121.jpg -all:all f200_3121.jpg
    1 image files updated
exiftool -uw* f200_3121.jpg
UW Depth                        : 6.0198


UWDepth exists in the processed file but, as I haven't got the .ExifTool_config file in place, shouldn't I have got an error when trying to write UWdepth from the original to the processed file with all:all?

Title: Re: Contents of .ExifTool_config
Post by: Phil Harvey on August 21, 2015, 10:10:49 AM
I think that you will see these warnings if you add -v2, but then you will also see why they aren't visible by default.

- Phil
Title: Re: Contents of .ExifTool_config
Post by: Alan Clifford on August 21, 2015, 11:18:52 AM
exiftool -v2 -overwrite_original_in_place -tagsfromfile ~/photographs/temp/f200_3121.jpg -all:all f200_3121.jpg | less -i

I think I see what is happening.  Searching the output for uw finds nothing without the .ExifTool_config file in place so the tag is being completely ignored.   I wasn't expecting that;  I was expecting it to be read and then warned/ignored.

Not a problem, I was just curious and it's good to know what is going to happen with this tag in different circumstances.
Title: Re: Contents of .ExifTool_config
Post by: Phil Harvey on August 21, 2015, 11:26:27 AM
Ah, sorry.  It needs to be -v3.  You should get this:  "Tag 'UWDepth' does not exist".

- Phil