Write rondom datetimeoriginal

Started by JanK, July 14, 2014, 06:33:04 AM

Previous topic - Next topic

JanK

Hi,

is there a way to rewrite the "DateTimeOriginal" of 300 images with an rondom date? Regardless which date.

I have a software which plays the picture in a Slideshow in order to the datetimeoriginal. But I will have a rondom order. So I will rewrite the tag.
-Mac OSX Mountain Lion-

Phil Harvey

You can do this with a user-defined Composite tag.  Here is a config file that will do it:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        RandomDate => {
            Require => 'FileName',
            ValueConv => sub {
                return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d",
                    rand(15) + 2000, #year
                    rand(12) + 1, # month
                    rand(28) + 1, # day
                    rand(24), # hour
                    rand(60), # minute
                    rand(60)  # second
                );
            },
        },
    },
);
# end


And the command would be:

exiftool -config my.config "-datetimeoriginal<randomdate" DIR

where DIR is a directory containing the images.

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