Difference between revisions of "ReNamer:Scripts:Exiv2"
Jump to navigation
Jump to search
(first version) |
(→Code: source tag) |
||
Line 9: | Line 9: | ||
Author: Denis Kozlov. Date: 10 Mar 2008. Extract unformatted line out of the command line output of the exiv2.exe tool. At the moment, this script extracts image timestamp. Adjust EXIV and TAG constants to extract other tags. | Author: Denis Kozlov. Date: 10 Mar 2008. Extract unformatted line out of the command line output of the exiv2.exe tool. At the moment, this script extracts image timestamp. Adjust EXIV and TAG constants to extract other tags. | ||
− | < | + | <source> |
{ Insert EXIF/IPTC/XMP tags from images } | { Insert EXIF/IPTC/XMP tags from images } | ||
Line 29: | Line 29: | ||
end; | end; | ||
end. | end. | ||
− | </ | + | </source> |
For example, to extract IPTC Headline tag, you would need to make following changes: | For example, to extract IPTC Headline tag, you would need to make following changes: | ||
− | < | + | <source> |
EXIV = '"exiv2.exe" -pi'; | EXIV = '"exiv2.exe" -pi'; | ||
TAG = 'Iptc.Application2.Headline\s*\w*\s*\d*\s*(.*?)[\r\n]'; | TAG = 'Iptc.Application2.Headline\s*\w*\s*\d*\s*(.*?)[\r\n]'; | ||
− | </ | + | </source> |
Revision as of 02:05, 3 August 2009
Script integrates Exiv2 library in order to extract EXIF/IPTC/XMP tags from many types of images. CRW, CR2, RAW images are also supported.
Requirements
- ReNamer v5.20 Beta
- exiv2.exe v0.16 in ReNamer's folder
Code
Author: Denis Kozlov. Date: 10 Mar 2008. Extract unformatted line out of the command line output of the exiv2.exe tool. At the moment, this script extracts image timestamp. Adjust EXIV and TAG constants to extract other tags.
{ Insert EXIF/IPTC/XMP tags from images }
const
EXIV = '"exiv2.exe"';
TAG = 'Image timestamp\s*\:\s*(.*?)[\r\n]';
var
Command, Output: String;
Matches: TStringsArray;
begin
Command := EXIV+' "'+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.
For example, to extract IPTC Headline tag, you would need to make following changes:
EXIV = '"exiv2.exe" -pi';
TAG = 'Iptc.Application2.Headline\s*\w*\s*\d*\s*(.*?)[\r\n]';