ReNamer:Scripts:ExifTool
This script integrates ExifTool command tool in order to extract EXIF/IPTC/XMP tags from many types of images. CRW, CR2, RAW, HEIF/HEVC images are also supported.
Requirements
exiftool.exe
in ReNamer's folder.
Download and extract the ExifTool package into ReNamer's folder.
Note that the ExifTool for Windows package contains a file named exiftool(-k).exe
, which must be renamed to exiftool.exe
before using in ReNamer. Otherwise, the command line tool interprets the (-k)
text as a trigger to wait for the user to press the ENTER key at the end of the output, which ReNamer won't be able to do and the application will just freeze.
Script
Replace the filename with the "Date/Time Original" meta tag.
The meta tag output is used "as is" and it often contains invalid filename characters, so you may need to use additional rules to clean up the filename afterwards.
You can check the full list of available meta tags by running exiftool.exe <file>
command and then you can modify the TAG
constant to work with any of the listed tags.
- Tested with ReNamer 7.4 and ExifTool 12.52.
const
EXE = 'exiftool.exe -t -charset filename=utf8';
TAG = 'Date/Time Original' + '\t(.*?)[\r\n]';
var
Command, Output: String;
Matches: TWideStringArray;
begin
Command := EXE + ' "' + FilePath + '"';
if ExecConsoleApp(Command, Output) = 0 then
begin
Matches := SubMatchesRegEx(Output, TAG, False);
if Length(Matches) > 0 then
FileName := Matches[0] + WideExtractFileExt(FileName);
end;
end.