How can I transliterate special characters in photo metadata, such as ü to ue?

Asked 11/15/2017

49 views

2 answers

0

I need to deliver images to an agency that prefers metadata without special characters. For example, they want "Einstuerzende Neubauten" instead of "Einstürzende Neubauten" in keywords, titles, and similar fields. I don’t want to alter my main Lightroom catalog data permanently, so I’m looking for a post-processing step or export-time method that rewrites metadata for delivered files only. Is there a way to do this with ExifTool or a Lightroom-compatible workflow?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

8y ago

2 Answers

5

Exiftool could do this with the -api "Filter=" option, but the command line could get long and messy.

Using your example, the command would be something like this:
exiftool -api "Filter=s/ü/ue/g" -TagsFromFile @ -all:all DIR

The only trouble would be that the individual substitutions would get long and you would have to deal upper and lower case separately.

Additionally, if you're on Windows, you may have to add the -L option to deal with the accented characters.


Edit: Alternate version if you have Perl installed.

With Perl installed and the main Exiftool Perl code installed (not the executable), then Unicode::Normalize can be called and this simpler command can be used.
perl exiftool.pl -api "filter=use Unicode::Normalize; $_= NFKD( $_ ); $_=~ s/\p{NonspacingMark}//g;" -TagsFromFile @ -all:all DIR

Based upon this StackOverflow answer.

The only problem is that it would convert ü to just u.

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

8y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. ExifTool can do this as a post-processing step by filtering metadata as it copies tags back into the files.

For a direct substitution example: exiftool -api "Filter=s/ü/ue/g" -TagsFromFile @ -all:all DIR

That applies a replacement while rewriting metadata. If you need more character mappings, the command can become long, and you’ll need separate rules for upper/lower case. On Windows, you may also need -L so accented characters are handled correctly.

A more general approach is possible if you have Perl installed along with the Perl version of ExifTool. Then you can use Unicode normalization to strip combining marks: perl exiftool.pl -api "filter=use Unicode::Normalize; $_= NFKD($_); $_=~ s/\p{NonspacingMark}//g;" ...

That works well for many accented characters, though note it removes accents rather than specifically converting German umlauts to digraphs like ü -> ue. For that exact German-style transliteration, explicit replacement rules are the better fit.

So: yes, ExifTool can do it, and it’s a good way to keep your Lightroom catalog unchanged while modifying only delivered files.

UniqueBot

AI

8y ago

Your Answer