Cameradependend date?

Started by schlemiel29, September 10, 2010, 05:49:21 AM

Previous topic - Next topic

schlemiel29

Hi,
maybe my intension is a little bit far, but I try to do this:
My girlfriend and me were taking photos. Her camera clock was not set exactly. It was not only set to local time. This differed 1 hour but additionaly 7 minutes. So comparing exifs of taken photos the same time I know, that the exifs differs in 01:07:00.
I don't want to change the exifs of the photos itself. Only getting the output for my list:

exiftool -filename -directory -createdate . -t -S -q -r -f >out.txt

Every photo of camera name "400D" should be handled the way, that the time is reduced by 01:07:00. All others should remain untouched.

By the way: I didn't understand the way to include only files of some extension, e.g. .JPG, .CR2, .TIFF ... when using -r option.

Best regards,
Dirk

BogdanH

Hi,

If I understand correctly, then what I would do is something like:

exiftool -AllDates-="01:07:00" -if "$Exif:Model=~/400D/" *.jpg

-this will decrease all DateTime values by 1h 07min on all JPG files (inside current/working folder) which contain "400D" signature inside Model tag.
Hope this helps.

Bogdan

Phil Harvey

Hi Dirk,

It sounds like you want to convert an extracted value.  This is what the user-defined tags are for.  Specifically, you could use this config file to create a shifted CreateDate tag:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyDate => {
            Require => 'CreateDate',
            ValueConv => q{
                require 'Image/ExifTool/Shift.pl';
                Image::ExifTool::ShiftTime($val, '1:07', -1);
                return $val;
            },
            PrintConv => '$self->ConvertDateTime($val)',
        },
    },
);


Bogdan's -if option is the way to process only images from a specific camera model.

To process only certain file types, use -ext jpg -ext cr2 -ext tiff, etc on the command line.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

schlemiel29

Wow!  :o
Hi Phil,
you are right, I need files from both cameras, but without changing the files itself. So the idea of Bogdan is good, but will change the file.
The config file looks great, but I think I have to surrender!  :D I don't understand anything of this.
I was working with a command line. So adding an additional command would be ok, but how should I handle this config file in my comand line????
Thanks for the file type list, that's easy.
Thanks,
Dirk

Phil Harvey

Hi Dirk,

You must save the code in my last post to a file, then you can either install this as the default exiftool config file (read the config file documentation for details), or use the -config option to load it from the command line.  Note: the -config option must come first on the command line if you use it.

Also, don't cut and paste the code using Safari or you will get funny characters that will cause problems.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Hi again Dirk,

I just thought of another solution which would work and doesn't change the file itself:

First, set the filesystem modification date/time to the create date for these images (if it isn't already):

exiftool "-filemodifydate<createdate" -r -ext jpg -ext cr2 "$model=~/400D/" DIR

Then, shift this date/time:

exiftool -filemodifydate-=1:07 -r -ext jpg -ext cr2 -if "$model=~/400D/" DIR

Then you can use FileModifyDate as the adjusted date/time.

These commands will not change the file at all, just the file modification timestamp for the file (which is stored by the system).

It is a bit more work, but it allows you to do what you want without the need for a config file.

There is always more than one way to solve a problem. :)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

schlemiel29

Hi Phil,
that seems to be the best. Looks logical to me, simple to write in a command line. I will try it. But I'm sure it will work perfectly.
1000 + 1 thanks!  :D
Dirk