2
\$\begingroup\$

I have used different Olympus digicams, but the "Make" EXIF field is not consistent in their images. This means certain image management software groups them into different manufacturers, such as "OLYMPUS IMAGING" and "OLYMPUS OPTICAL" as well as simply "OLYMPUS."

So I want to examine a huge number of pictures' EXIF data, look for a "Make" tag that begins with "OLYMPUS ", and change all those so they simply say "OLYMPUS".

Is this possible using only exiftool? I can do some bash or perl scripting, but I was under the impression that exiftool could do this sort of thing all on its own. I don't really want to fire up exiftool 400,000 times inside some other script if I don't have to.

I did Read The Fine Manual, but the ~80 page man page for exiftool is pretty intimidating, and I didn't see this sort of functionality right off the bat.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Your command would be
exiftool -if "$Make=~/^OLYMPUS /" -Make=OLYMPUS DIR

This command takes the Make tag and performs a check to see if it matches the RegEx expression ^OLYMPUS (including the space at the end). If the make tag does match, then it will rewrite the tag to just be OLYMPUS. Replace DIR with the directory paths and/or files you wish to process. Multiple paths/files can be used.

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.

\$\endgroup\$
5
  • \$\begingroup\$ Why match with the trailing space? Assuming the OP's specifications were correctly typed, "OLYMPUS." (with trailing period in the string) is a possible input. I suggest just matching anything beginning with "OLYMPUS", and writing "OLYMPUS" back out. I suppose if you wanted to be strict and not update files that already have the correct tag, the match "/^OLYMPUS./" would accept any single character following OLYMPUS and not just the space character. \$\endgroup\$
    – scottbb
    Dec 14, 2018 at 2:13
  • \$\begingroup\$ Another option is to use \b to mark the word boundaries: exiftool -if '$Make =~ /\bOLYMPUS\b/' -Make="OLYMPUS" . – It's unusual to see Exif tags ending with periods. American English has punctuation inside of quotation marks, so it's not necessarily clear whether the period is intended to be part of the quote (though a later sentence has the period outside of the quotation mark; American English is also known for its inconsistency). \$\endgroup\$
    – xiota
    Dec 14, 2018 at 4:24
  • \$\begingroup\$ To be honest, I assumed American English, as xiota said. But the main reason for the trailing space was to avoid re-writing files that were already set to just "OLYMPUS". Checking Phil Harvey's ExifTool Meta Information Repository, almost all the Olympus samples contain either "OLYMPUS CORPORATION", "OLYMPUS IMAGING CORP.", or "OLYMPUS OPTICAL CO.,LTD" in the Make tag. \$\endgroup\$
    – StarGeek
    Dec 14, 2018 at 5:15
  • \$\begingroup\$ Thanks all for your comments! scottbb, see @StarGeek's comment. xiota, I assumed scottbb used the period as the regex for "match any single character." StarGeek, thanks for checking the info repository; I was going by what <a href="mylio.com">Mylio</a> reported. It shows three groups of Olympus cameras, including "OLYMPUS IMAGING", "OLYMPUS OPTICAL", and just plain "OLYMPUS". I'm guessing Mylio clipped the " CORPORATION" off the later one. Too many cooks in the kitchen... :-) \$\endgroup\$ Dec 16, 2018 at 1:36
  • \$\begingroup\$ So, with my goal to get all the various OLYMPUS monikers to show up in the same list in Mylio, and to have it consistent with whatever the latest Olympus calls itself, I think what I want is "exiftool -if "$Make=~/^OLYMPUS [OI]" -Make="OLYMPUS CORPORATION", where the regex matches anything starting with "Olympus " and either an "O" (for "OPTICAL") or an "I" (for "IMAGING".) \$\endgroup\$ Dec 16, 2018 at 1:41

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.