This script was developed by ChatGPT o1 with human suppervision of Arthur Soares Website / Threads :).
On a Leica M digital camera, lenses are normally identified via an internal “6-bit encoding.” Leica’s native lenses have unique codes, and the camera writes lens info to the file’s EXIF metadata. However, third-party lenses (Voigtländer, Zeiss, etc.) often lack an official Leica 6-bit code, so photographers commonly “reuse” a Leica lens code with similar focal length and aperture. This results in Leica Summicron lens info showing up in the metadata even when you’re shooting with, say, a Voigtländer 35 mm f/2 Ultron.
This script uses ExifTool to:
- Find
.DNG
files whose EXIF/XMP fields mention “Summicron” (or older Voigtländer labels). - Overwrite lens-related fields so they correctly identify your third-party lens (e.g., “Voigtlander VM 35mm f/2 Ultron Aspherical”), including focal length, aperture, and brand name.
- Update Adobe-specific lens-profile fields (XMP-crs) to reflect a custom lens correction profile rather than the default Leica Summicron reference.
- Go (1.18+ recommended)
- ExifTool installed and in your
PATH
.- macOS:
brew install exiftool
- Linux: your package manager, or from ExifTool website
- Windows: Download ExifTool for Windows
- macOS:
- Save the code below in a file named, for example,
fix_6bit_exif.go
. - In a terminal, run:
go build fix_6bit_exif.go
- Search:
The script runs ExifTool with
-if
conditions that look for Summicron references in EXIF or XMP metadata (e.g.,"Summicron-M 1:2/35 ASPH."
) or older Voigtländer strings. - Rewrite:
If there’s a match, the script sets the following fields to your desired Voigtländer lens name and specs:
- EXIF:
LensMake
,LensModel
,FocalLength
,LensInfo
- XMP-AUX:
aux:Lens
- XMP-CRS:
LensProfileName
,LensProfileFilename
,LensProfileDigest
, etc.
- EXIF:
- Output:
- After a preview (if you use
-dry-run
), the script overwrites.DNG
metadata in place, so any future software (Lightroom, Photoshop, etc.) sees the correct lens info.
- After a preview (if you use
- LensMake: e.g.,
"Voigtlander"
. - LensModel: e.g.,
"Voigtlander VM 35mm f/2 Ultron Aspherical"
. - FocalLength: numeric focal length, e.g.,
"35.0mm"
. - LensInfo: condensed specs, e.g.,
"35mm f/2"
.
- XMP-aux:Lens: Adobe-specific lens name. Must be updated or Lightroom might still show Summicron.
- LensProfileSetup: typically set to
Custom
. - LensProfileName: descriptive string, e.g.,
"Adobe (Voigtlander VM 35mm f/2 Ultron Aspherical)"
. - LensProfileFilename: the
.lcp
file name, e.g.,"Leica Camera AG (Voigtlander VM 35mm f2 Ultron Aspherical) - RAW.lcp"
. - LensProfileDigest: a unique hash for the lens profile (e.g.,
"03CBD374CCB89A292AD832BB830E440F"
). - LensProfileIsEmbedded: usually
False
unless it’s truly embedded.
- EXIF readers, Lightroom, etc., will incorrectly list Summicron in the file info.
- Lens corrections in Adobe Camera Raw may apply the wrong correction profile if you leave Summicron metadata untouched.
By correcting the metadata, you ensure all software knows the true lens model, focal length, and aperture. You can also load or reference a custom lens profile for your third-party lens rather than Leica’s Summicron corrections.
By default, we treat both 1 and 2 as “no matches,” which means we skip them. If you want to fail on a genuine parameter error, remove the code || code == 2
in runExifToolIgnoreNoMatches
.
Just append a new LensFix to the lensFixes array. For example:
{
Condition: LensCondition{
AuxLensValues: []string{
"Summicron-M 1:2/50 ASPH.",
// etc.
},
CrsProfileValues: []string{
"Adobe (Leica SUMMICRON-M 50 mm f/2 ASPH.)",
},
},
LensMake: "Zeiss",
LensName: "Zeiss ZM 50mm f/2 Planar",
FocalLength: "50.0mm",
Aperture: "f/2",
// etc.
},
We already do -ext dng in the script. That ensures ExifTool only processes DNG files.
Yes. -overwrite_original modifies the original files and prevents .DNG_original backups. If you want backups, remove that flag or pass your own ExifTool arguments.
You can run the command exiftool -a -u -G1 -s FILENAME.DNG
to print out the EXIF values and find the fields you want to update.
Manually change the Lens Correction in Lightroom, make sure you "write the metadate to file", and then run exiftool -a -u -G1 -s FILENAME.DNG
to see the LensProfileName
, LensProfileFilename
, and LensProfileDigest
fields.
Enjoy accurate lens metadata for your Voigtländer (or other third-party) lenses!
This is the result of running the script.