Import Data from TXT file into many PSD, TIF & JPG Files

Started by Archive, May 12, 2010, 08:53:56 AM

Previous topic - Next topic

Archive

[Originally posted by snah on 2006-08-14 01:05:24-07]

Hello

I have been using EXIFTOOL for a limited time only. I find it a really great tool. (Just a bit difficult to get the proper command lined up - but never mind).

As of now I have extracted DateTime/Original and Filename for each of my SIGMA RAW-Files (.X3F) into a TXT file that I used to import its data into my IVMP (iView Media Pro v3.1.) Database by means of a VB script that associates each X3F-File with my converted ImageFiles (for about 20'000+ images).

I am now looking for assistance in creating an EXIFTOOL-commandline that reads the information from a given TXT file and inserts its data into the corresponding image files.

The TXT file contains the following:

Filepath;Filename;EXIF.Creation.Date

The files to write this data into are TIF, PSD and JPG.

Hope to find someone who can provide me some helpful tips and maybe even some commandline code to obtain this goal.

For the interested reader of this thread I have included some additional information just below.

I will very much appreciate any helpful advice and looking forward to hearing from someone soon.

With kind regards from Switzerland, Hans.

-----------------------------------------

More Info:

The reason I like to do this is simple. iVMP does not read the DateTime/Original TAG from the RAW Files and once it's there (explained below) iVMP does not write it back to the image file (EXIF TAG).

As I still want to have the information of the RAW DateTime/Original in my converted images, I extracted and imported it into iVMP.

The problem now is that iVMP does not write the new value for DateTime/Original back to the actual imagefiles TIF, PSD, JPG (no worries about the original RAW Files that I'd like to keep original).
I am certain EXIFTOOL can do that.

What I aiming at is that images created from RAW File(s) - sometimes many for Panoramas or for extending the dynamic range of an image - receive the DateTime/Original from the corresponding RAW File(s) (if there are many then the first occurrence).
 
This is probably possible due to the naming I am using. An example: say we've got an image file named IMG01234-01241.PSD (and JPG for WEB). This image is created from the 8 TIF Files named IMG01234.TIF - IMG01241.TIF. The TIF Files were created from their equally named RAW Files IMG01234.X3F - IMG01241.X3F.

So the PSD, TIF and the JPG files should now get their peers DateTime/Created TAG updated based on
the information in the RAW File.

What I have done so far:

- Use EXIFTOOL and export DateTime/Original and Filename from all RAW Files on one drive. This is done by using the following command:

Code:
exiftool.pl -p c:\tmp\x3f_header_list.txt -r -ext .x3f * \images >c:\tmp\flistEXIF.txt

- The generated data got imported into iVMP Database for all associated PSD, TIF and JPG Files.
(done by VB Script).

- Create a TXT File containing: Filepath;Filename;EXIF.Creation.Date

What's left is to get this information into the actual files (as iVMP does not do it) by means of EXIFTOOL.

But how? Sorry but I couldn't find info for such an import.

I am looking for assistance in creating an EXIFTOOL-commandline that reads from a TXT file and inserts its data into the corresponding image files.

Archive

[Originally posted by exiftool on 2006-08-22 12:54:40-07]

To do this, you need to write a script to read the TXT file, parse the date, and write the CreateDate tag:

Code:
#!/usr/bin/perl -w
use strict;
BEGIN { push @INC, 'lib' }
use Image::ExifTool;
my $exifTool = new Image::ExifTool;

my $txt = shift or die "Syntax: SCRIPT file.txt imagefile [imagefile ...]\n";

open FILE, $txt or die "Error opening $txt\n";
my $buff = <FILE>;
chomp $buff;
my @tags = split /;/, $buff;
@tags > 2 or die "Error parsing $txt\n";
my $date = $tags[2];
# check date format
$date =~ /(\d+:\d+:\d+ \d+:\d+:\d+\S+)/ or die "Improper date format ($date)\n";
$date = $1;

for (;;) {
    my $file = shift or last;
    $exifTool->SetNewValue(CreateDate => $date);
    print "File: $file\n";
    print "  Updating CreateDate => $date\n";
    my $result = $exifTool->WriteInfo($file);
    if ($result == 1) {
        print "  Done.\n";
    } elsif ($result == 2) {
        print "  Nothing changed.\n";
    } else {
        print "  Write Error!\n";
    }
}
# end

Let me know if you have any questions.

- Phil