1
\$\begingroup\$

I have multiple images that have been scanned from 6x4 prints, not knowing when the photo has been taken, most of the photos have not been taken on a particular event, but knows the year taken.

A one command to randomise the creation date on multiple JPG images on a specific year.

\$\endgroup\$
2

1 Answer 1

2
\$\begingroup\$

The easiest way to do this would be to first set all files to the first second of the year you want to randomize
exiftool -CreateDate="1985:1:1 0:0:0" /path/to/files/

Then you could shift that time by a random number of days/hours/minutes/seconds like this
exiftool "-CreateDate+<${Filename;$_=int(rand(365)).' ' .int(rand(24)).':'.int(rand(60)).':'.int(rand(60))}" /path/to/files

Here, Filename is used as a placeholder to access exiftool's Advanced formatting feature, i.e. using direct Perl code, to get a random day, hour, minute and second to add to the base time.

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories. If this command is run under Unix/Mac, reverse any double/single quotes to avoid bash interpretation.

See also: How can I incrementally date photos?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.