.exiftool_config for biological data

Started by Archive, May 12, 2010, 08:54:12 AM

Previous topic - Next topic

Archive

[Originally posted by eddiebug94601 on 2007-11-23 21:11:04-08]

Can someone help? I am working in Windows and need to create a batch file that will allow me to add at least a dozen custom tags to several thousand JPGs. Then, I would like to be able to extract the tags and data into a file that I can import into a database. Is that possible? I am not a programmer. I am a biologist. So, I do not have the savvy to follow directions that are too technical.

Eddie Dunbar

Archive

[Originally posted by exiftool on 2007-11-24 00:54:53-08]

Hi Eddie,

You don't need a batch file to do this.  Since there are so many tags,
it is probably easiest to put them in a text file (FILE.TXT).  Then use
the command:

Code:
exiftool -@ FILE.TXT -r -overwrite_original -P DIR

Here I have used -overwrite_original, so make sure you have
backed up all your images first.  The command will apply all arguments
from FILE.TXT to all images in directory DIR and its subdirectories.
All you have to do then is to create FILE.TXT containing lines like this

Code:
-author=Phil Harvey
-Copyright=2007
-anotherTag=something else

This will work if you want to use the same tags for all files.  Otherwise
it gets a bit more complicated but can be done.

To extract all the tags into a database, use:

Code:
exiftool -filename -@ FILE2.TXT -r -T DIR >out.txt

Where this time FILE2.TXT contains lines like this:

Code:
-author
-Copyright
-anotherTag

This will create an output text file called "out.txt" which is
a tab-delimted text file that you should be able to import
into any database.

Read the exiftool application documentation for more information
about the options I have used here.

- Phil

Archive

[Originally posted by eddiebug94601 on 2007-11-24 04:57:49-08]

I tried using the file.txt method. The only tag that got written was Keywords. Comments and GPS were rejected. The tags I was trying to write are not standard tags. So, I have been trying to get .exiftool_config to work. All it managed to do was to write my tags as values.

They tags I want to create are:

Taxon

TaxonCode

Phylogeny

Order

Family

Genus

Species

CommonName

Description

IdentificationBy

Country

State

County

CountyCode

Locality

LocalityCode

Sublocation

GPS

Importance

Control

Range

FlightPeriod

Food

Development

PhotoQuality

Aspect

Disposition

Photographer

Keywords

Comments

Eddie D.

Archive

[Originally posted by exiftool on 2007-11-25 13:38:30-08]

Make sure you are using the correct tag names.  "Comments"
and "GPS" are not valid tag names.

- Phil

Archive

[Originally posted by eddiebug94601 on 2007-11-25 15:50:08-08]

Phil - My goal is to create custom tags, but I am getting this message.

Tag 'Taxon' does not exist

Tag 'TaxonCode' does not exist

Tag 'Phylogeny' does not exist

Tag 'Order' does not exist

Tag 'Family' does not exist

Tag 'Genus' does not exist

Tag 'Species' does not exist

Tag 'CommonName' does not exist

Tag 'Description' does not exist

Tag 'IdentificationBy' does not exist

Tag 'Country' does not exist

Tag 'State' does not exist

Tag 'County' does not exist

Tag 'CountyCode' does not exist

Tag 'Locality' does not exist

Tag 'LocalityCode' does not exist

Tag 'Sublocation' does not exist

Tag 'Importance' does not exist

Tag 'Control' does not exist

Tag 'Range' does not exist

Tag 'FlightPeriod' does not exist

Tag 'Food' does not exist

Tag 'Development' does not exist

Tag 'PhotoQuality' does not exist

Tag 'Aspect' does not exist

Tag 'Disposition' does not exist

Tag 'Photographer' does not exist

Tag 'Keywords' does not exist

    1 directories scanned

    3 image files updated

The tags and values I want to use are as follows:

-Taxon=Coccinella_californica

-TaxonCode=00471

-Phylogeny=Insecta,Coleoptera,Coccinellidae,Coccinella californica

-Order=Coleoptera

-Family=Coccinellidae

-Genus=Coccinella

-Species=Coccinella californica

-CommonName=California ladybird beetle

-Description=color: burnt orange; pronotum black, forward margins with white square; size:5-7 mm

-IdentificationBy=Eddie Dunbar

-Country=USA

-State=California

-County=Alameda

-CountyCode=01

-Locality=Oakland, Melrose District

-LocalityCode=0101

-Sublocation=Congress@Ygnacio

-Importance=beneficial; biocontrol of softbodied arthropods on vegetables and ornamentals

-Control=none applicable
-Range=California, west to the Rockies

-FlightPeriod=May to November

-Food=predator; aphids, scale

-Development=homometabolous

-PhotoQuality=5

-Aspect=head@laterum

-Disposition=field photo; not collected

-Photographer=Eddie Dunbar

-Keywords=Insecta,Coleoptera,Coccinellidae,Coccinella californica, California ladybird beetle

Eddie Dunbar

Archive

[Originally posted by exiftool on 2007-11-25 19:02:36-08]

Have you read FAQ #11?  And what does your .ExifTool_config file look like?

- Phil

Archive

[Originally posted by eddiebug94601 on 2007-11-25 23:26:40-08]


I did read FAQ #11. ExifTool.exe, .ExifTool_config and the photos are all in the same directory. No changes were made to the .ExifTool_config, except to add: print "LOADED!\n";

"Loaded" does appear when I execute the batch file.

(Don't laugh) To add custom tags I was renaming the executable to:

exiftool(exiftool -v3 -NewIPTCTag=Phylogeny -k -P).exe
for each custom tag

I also tried a batch file that looks like this:

exiftool [IPTC:]Taxon+=Archaeognatha -overwrite_original -P

exiftool [IPTC:]TaxonCode+=value -overwrite_original -P

exiftool [IPTC:]Phylogeny+=value -overwrite_original -P

exiftool [IPTC:]Order+=value -overwrite_original -P

exiftool [IPTC:]Family+=value -overwrite_original -P

exiftool [IPTC:]Genus+=value -overwrite_original -P

exiftool [IPTC:]Species+=value -overwrite_original -P

exiftool [IPTC:]CommonName+=value -overwrite_original -P

exiftool [IPTC:]Description+=value -overwrite_original -P

exiftool [IPTC:]IdentificationBy+=value -overwrite_original -P

exiftool [IPTC:]Country+=value -overwrite_original -P

exiftool [IPTC:]State+=value -overwrite_original -P

exiftool [IPTC:]County+=value -overwrite_original -P

exiftool [IPTC:]CountyCode+=value -overwrite_original -P

exiftool [IPTC:]Locality+=value -overwrite_original -P

exiftool [IPTC:]LocalityCode+=value -overwrite_original -P

exiftool [IPTC:]Sublocation+=value -overwrite_original -P

exiftool [IPTC:]GPS+=value -overwrite_original -P

exiftool [IPTC:]Importance+=value -overwrite_original -P

exiftool [IPTC:]Control+=value -overwrite_original -P

exiftool [IPTC:]Range+=value -overwrite_original -P

exiftool [IPTC:]FlightPeriod+=value -overwrite_original -P

exiftool [IPTC:]Food+=value -overwrite_original -P

exiftool [IPTC:]Development+=value -overwrite_original -P

exiftool [IPTC:]PhotoQuality+=value -overwrite_original -P

exiftool [IPTC:]Aspect+=value -overwrite_original -P

exiftool [IPTC:]Disposition+=value -overwrite_original -P

exiftool [IPTC:]Photographer+=value -overwrite_original -P

exiftool [IPTC:]Keywords+=value -overwrite_original -P

exiftool [IPTC:]Comments+=value -overwrite_original -P

- Eddie Dunbar

Archive

[Originally posted by dinang on 2007-11-26 08:09:53-08]

More files for users. exiftool [IPTC:]Comments+=value -overwrite_original -P
http://www.blacktowhite.net/
exiftool [IPTC:]Comments+=value -overwrite_original -P

Archive

[Originally posted by exiftool on 2007-11-26 13:56:06-08]

Hi Eddie,

It sounds like you haven't defined your custom tags in the .ExifTool_config file.

You need to add a definition for each nonstandard tag that you want to define.

Once you get this working, you should be able to use the -@ option to
combine all your commands into one and simplify things quite a bit.

- Phil

Archive

[Originally posted by eddiebug94601 on 2007-11-27 03:45:16-08]


I sound smarter than I actually am. What are the chances that you could write this for me, and then post it back here? I enjoy the challenge of learning, but I would rather begin practicing with a model that works. I did not see a donation page anywhere on this forum. Directions?

Eddie Dunbar

Archive

[Originally posted by exiftool on 2007-11-27 13:29:58-08]

Hi Eddie,

There is a "donate" button available from the
ExifTool
home page
.

Here is your ".ExifTool_config" file:

Code:
%Image::ExifTool::UserDefined::Biology = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-bio', 2 => 'Image' },
    NAMESPACE     => { 'bio' => 'http://eddie.dunbar.com/bio/1.0/' },
    WRITABLE      => 'string',
    Taxon => { },
    TaxonCode => { },
    Phylogeny => { },
    Order => { },
    Family => { },
    Genus => { },
    Species => { },
    CommonName => { },
    Description => { },
    IdentificationBy => { },
    Country => { },
    State => { },
    County => { },
    CountyCode => { },
    Locality => { },
    LocalityCode => { },
    Sublocation => { },
    GPS => { },
    Importance => { },
    Control => { },
    Range => { },
    FlightPeriod => { },
    Food => { },
    Development => { },
    PhotoQuality => { },
    Aspect => { },
    Disposition => { },
    Photographer => { },
    Comments => { },
);

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # new XMP namespaces (ie. XMP-bio) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        bio => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::Biology',
            },
        },
    },
);

1;  #end

And here is your arguments file (let's call it "my.args"):

Code:
-XMP:Taxon=Coccinella_californica
 -XMP:TaxonCode=00471
 -XMP:Phylogeny=Insecta
 -XMP:Phylogeny=Coleoptera
 -XMP:Phylogeny=Coccinellidae
 -XMP:Phylogeny=Coccinella californica
 -XMP:Order=Coleoptera
 -XMP:Family=Coccinellidae
 -XMP:Genus=Coccinella
 -XMP:Species=Coccinella californica
 -XMP:CommonName=California ladybird beetle
 -XMP:Description=color: burnt orange; pronotum black, forward margins with white square; size:5-7 mm
 -XMP:IdentificationBy=Eddie Dunbar
 -XMP:Country=USA
 -XMP:State=California
 -XMP:County=Alameda
 -XMP:CountyCode=01
 -XMP:Locality=Oakland, Melrose District
 -XMP:LocalityCode=0101
 -XMP:Sublocation=Congress@Ygnacio
 -XMP:Importance=beneficial; biocontrol of softbodied arthropods on vegetables and ornamentals
 -XMP:Control=none applicable -Range=California, west to the Rockies
 -XMP:FlightPeriod=May to November
 -XMP:Food=predator; aphids, scale
 -XMP:Development=homometabolous
 -XMP:PhotoQuality=5
 -XMP:Aspect=head@laterum
 -XMP:Disposition=field photo; not collected
 -XMP:Photographer=Eddie Dunbar
 -XMP:Subject=Insecta
 -XMP:Subject=Coleoptera
 -XMP:Subject=Coccinellidae
 -XMP:Subject=Coccinella californica
 -XMP:Subject=California ladybird beetle

Once you have installed the ".ExifTool_config" file in your home directory
or the exiftool directory, then you can use the following command to write
all tags in the "my.args" file:

Code:
exiftool -@ my.args DIR

Where DIR is a directory containing your images.  "my.args" must be in the
current directory for this to work.

Note that in general it is better to use existing tags if possible instead of
defining your own.  This way, other software may be able to understand
some of the information you have added.  So I would suggest looking through
the list
of XMP tags
to try to use as many as possible instead of defining your own.
Here, I have done this for one tag, and used XMP:Subject instead of Keywords
since this is the accepted place to store keywords in XMP.

Also, I have made one tag (Phylogeny) a list-type tag, which stores the values
separately but combines them into a comma-delimited list when reading.
You may want to do this for other tags too because it allows you to add
and delete single items from a list much more easily.  This is the way that
XMP:Subject is defined as well.

- Phil

Archive

[Originally posted by eddiebug94601 on 2007-11-28 03:22:29-08]


This is amazing! I am speechless. ExifTool is incredible. My goal was to get a tool to embed and extract biologically relevant metadata. Now I can do it!

Eddie Dunbar
BugPeople LLC
Oakland CA

Archive

[Originally posted by pbostock on 2007-11-28 11:13:46-08]

Hi, Eddie and Phil,

I'm impressed too with this xmp extensibility and with the ability of ExifTool to process it. I'm working on metadata and images for a herbarium (images of plants in particular) and considering imbedding our image database fields, very similar to those of Eddie's.

One comment about your schema, Phil. You mention the list for Phylogeny, but I think you didn't define it. I assume the .exiftool_config entry should look like

Code:
Phylogeny => { List => 'Bag'},

and seems to be intended to store alternatives (in different languages?), rather than the hierachical information presented by Eddie. In the dotted format of IMatch categories, the Phylogeny field would be "Insecta.Coleoptera.Coccinellidae.Coccinella californica".

By the way, there is an organisation, the Taxonomic Database Working Group (TDWG) which already administers a number of world standards for biological metadata. I see that they have an imaging group in their lineup, so perhaps there will be a biological addition to XMP in the future.

Thanks again for your fantastic work, Phil.

Peter

Archive

[Originally posted by pbostock on 2007-11-28 11:15:55-08]

oops - after the Phylogeny entry, I meant to say "and Subject seems to be intended to store alternatives..."

Peter

Archive

[Originally posted by exiftool on 2007-11-28 16:10:32-08]

Peter,

Thanks for pointing this out.  I just noticed this myself.  I changed this
tag to a Bag after I had pasted the config file.  So what you have said is
correct.  There are different list types, and I made it a "Bag".  If it is
a set of language alternatives, this is handled a bit differently and
in place of { List => 'Bag' }, you would need
{ Writable => 'lang-alt' }.

- Phil