How can I batch add lens metadata to many Lightroom photos on Windows?
Asked 11/4/2014
1 views
2 answers
0
I’m using a manual Rokinon 8mm fisheye, so my files don’t include lens or aperture metadata. I’ve tried the Lightroom plugin LensTagger to batch add this information, but on Windows it has several problems: it can fail with larger batches (around 100+ files, depending on file path length), has trouble with non-Latin filenames/folders, is slow, and blocks Lightroom’s UI while running. Is there an easier way to add lens metadata to 100–200 photos at once?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
11y ago
2 Answers
2
Doesn't work on many files (more than 100, depends on the length of file paths)
That's due to a hard limit in Windows on the length of a command line. The plugin is trying to name all of the photos you've selected in a single ExifTool instantiation.1
The only thing you can do about this is upgrade to Windows 7+, if you haven't already. The limit in XP and Vista is considerably shorter.2
You should also write to the plugin's author, asking him to work around this limit. For instance, it could detect when it is getting close to the limit and start a new ExifTool command. Repeat until all photos are fixed. You'd pay some overhead in the repeated ExifTool calls, but simply gathering several dozen per call will still get you most of the benefits of the launch time amortization.
Meanwhile, you can use Lightroom itself to keep track of where you are in the project, as you bite off ~100 photos at a time. I'd do it this way:
In the Library, open the Metadata filter, then select "Unknown Lens" in the "Lens" column.
In the grid below the filters, select several rows of pictures, and run them through LensTagger.
When the plugin finishes, close it and say Metadata > Read Metadata from Files. As each photo's new lens metadata loads in, it will disappear from the grid, since its lens is now "known."
Repeat until done. :)
Doesn't work on non-latin unicode filenames/folders
I'm not sure what's going on with that. LensTagger uses ExifTool for this, which is written in Perl, which is arguably the most Unicode-capable programming language available. Windows itself is also Unicode-aware, going back to Windows NT 3.1, in the early 1990s. LR itself is also not likely the problem, since plugins are written in Lua, which is also Unicode-aware, though not to the same extent as Perl or the Windows SDK.
If I had to guess, I'd say it's probably in the ExifTool command line parsing code, since Perl doesn't do the right thing with Unicode text by default in I/O. It has all the tools you need to do Unicode right, but you have to write your code to make explicit use of those tools; you don't get it for free.
I'd file it with the plugin author as a bug report.
Needs to read Metadate from file manually after each
That's due to a hard limit in the Lightroom SDK.
If the SDK were to allow this, it would do so via the photo:setRawMetadata() API call. The v5 SDK simply doesn't include an option for setting lens data.
This is unfortunately the common case. There are only about 60 metadata fields you can set via this LR SDK API call, whereas ExifTool knows about twice that many metadata formats, each of which defines many fields. I'd estimate that ExifTool lets you set a few orders of magnitude more fields than the LR SDK does.
Want it fixed? Complain to Adobe. Not that I hold out much hope for this option. The LR 5.0 SDK didn't add any new fields relative to 4.0.
Footnotes:
This is a good idea since it amortizes ExifTool's startup time over the photo set. Running it once per photo would take a significant amount of time.
That, or switch to OS X, which doesn't have this limit. :)
I've got LensTagger running in the background on 638 photos right now on my OS X box. LensTagger had to create a ~158 kiB command line to pull this off.
Originally by user4141. Source · Licensed CC BY-SA 4.0
user4141
11y ago
0
Generated from our catalog & community — verify before relying on it.
The main batch-size problem is likely a Windows command-line length limit. LensTagger appears to pass many selected filenames to ExifTool in one command, and once that command gets too long, it fails.
Practical options:
- Split the job into smaller batches for now.
- Contact the plugin author and ask for a workaround: the plugin could run multiple ExifTool calls automatically instead of trying to process everything in one command.
- If you’re on an older Windows version, newer versions have less restrictive limits than XP/Vista.
If LensTagger is also struggling with Unicode paths or blocking Lightroom, that points to plugin limitations rather than Lightroom itself. In that case, using ExifTool directly outside Lightroom may be a better approach, since it avoids the plugin UI issues and may give you more control over batching.
So yes, it can be done for 100–200 photos, but the reliable approach is usually to process in smaller groups or use a tool/workflow that breaks the work into multiple commands automatically.
Recommended products
UniqueBot
AI11y ago
Your Answer
Related Questions
Why would jhead -autorot leave photos looking wrong, while -norot fixes them?
Can Photoshop pause during a batch action so I can preview each image?
How can I find which Lightroom catalog contains a specific photo?
Which EXIF tag should I set for 35mm-equivalent focal length on a manual lens?
Why do photo files become corrupted on hard drives, and how can I prevent it?