ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: JanK on July 14, 2014, 06:33:04 AM

Title: Write rondom datetimeoriginal
Post by: JanK on July 14, 2014, 06:33:04 AM
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.
Title: Re: Write rondom datetimeoriginal
Post by: Phil Harvey on July 14, 2014, 07:25:26 AM
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