ExifTool Forum

ExifTool => Newbies => Topic started by: niels123 on June 22, 2016, 10:02:26 AM

Title: Update LensType and LensID fields
Post by: niels123 on June 22, 2016, 10:02:26 AM
My friend and I shoot with special microscope lenses attached to normal camera lenses. I managed to update the Lens and LensModel fields with a new "Canon ... + microscope objective ..." string and it works perfectly in lightroom.

My friend however, uses Aperture and if I send him and updated CR2, he still sees the old info, probably from LensType / LensID.
1) Which fields does Aperture read to determine the lens? Is there a way to tell Aperture that a "Canon 200mm f/2.8 + Nikon 4x NA 0.10" is attached and that this is displayed in the "Lens" field inside Aperture?

2) I tried to modify the LensType. It doesn't get updated and stays unchanged, but the Lens and LensModel fields change nicely. What goes wrong here? What I try, as an example, is:

"C:\ExifTool\exiftool.exe" -LensType="747" -m -overwrite_original_in_place -P "T:\test\5D3_1097.CR2"


Many thanks!
Niels
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 22, 2016, 10:10:22 AM
Quote from: niels123 on June 22, 2016, 10:02:26 AM
1) Which fields does Aperture read to determine the lens?

I can't say.

Quote2) I tried to modify the LensType. It doesn't get updated and stays unchanged, but the Lens and LensModel fields change nicely. What goes wrong here?

I think this is FAQ 6 (https://exiftool.org/faq.html#Q6).  Try adding -n to your command, or writing -lenstype# instead of -lenstype.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 22, 2016, 10:46:15 AM
Thanks it works!

Is there a way to get other data in there to have LensType to show a custom string which is not in the LenType values table?

How about a Nikon lens with an adapter attached to a Canon Body? Is there a way to put a (third party) Nikon lens in a Canon raw file as LensType?
For example, The Zeiss Otus 55mm f/1.4ZE for Canon has LensType 198.1
The Nikon LensID in a NEF file would be '00 54 53 53 0C 0C 00 00'

One last question: how does it work with third party lenses in CR2 files? 198.1 is the LensType for Otus55 ZE, but if you manually put that in a raw file ExifTool says "Canon 50mm f/1.4 or Zeiss lens", which is exactly the same text which is displayed when you put "198" as LensType. If I open CR2 files taken with a Zeiss ZE lens attached LR nicely shows exactly which Zeiss lens was used, so I'm a bit confused here.
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 22, 2016, 10:57:20 AM
Quote from: niels123 on June 22, 2016, 10:46:15 AM
Is there a way to get other data in there to have LensType to show a custom string which is not in the LenType values table?

Is there a way to put a (third party) Nikon lens in a Canon raw file as LensType?

All that is written is a number.  ExifTool has a lookup table that converts this to a lens model.  You can write any number you want, but ExifTool will only recognized the ones listed here (https://exiftool.org/TagNames/Canon.html#LensType) for Canon cameras.

QuoteOne last question: how does it work with third party lenses in CR2 files? 198.1 is the LensType for Otus55 ZE, but if you manually put that in a raw file ExifTool says "Canon 50mm f/1.4 or Zeiss lens", which is exactly the same text which is displayed when you put "198" as LensType. If I open CR2 files taken with a Zeiss ZE lens attached LR nicely shows exactly which Zeiss lens was used, so I'm a bit confused here.

You're talking about LensID, which is a Composite tag (https://exiftool.org/TagNames/Composite.html) based on LensType and other things like FocalLength and MaxAperture.  Using this other information ExifTool attempts to determine which lens was actually used in cases where the LensType number is used by multiple lens models.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 22, 2016, 11:24:30 AM
So effectively, there is no LensType number for an original Nikon lens if attached to a Canon body? Or a Sony lens attached to a Canon mirrorless?
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 22, 2016, 11:39:17 AM
I can't say.  It depends on the adapter.  Smart adapters can generate fake LensType numbers.  I don't think I've seen this yet for a Canon adapter, but it could happen.  I've seen this for other makes.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 22, 2016, 06:18:16 PM
A LensType number can also be entered manually in post. I have one adapter for Nikon lenses on a Canon body, which is a mechanical-only coupling from Novoflex. I suppose that it is not possible to manually enter a LensType number in a CR2 file which is identified as a Nikon lens?
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 22, 2016, 10:11:57 PM
You can write any number you want to LensType using ExifTool.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 24, 2016, 03:06:59 AM
For technical reasons, I'd like to use my MP-E65mm Macro Photo as such that there is no electronic connection between my camera and the lens. In post, I want to add all lens info to the CR2 files. Most tags work fine, but one tag gives some problems. The stored InternalSerialNumber in a CR2 when the MP-E is connected is "VC0863533". If I try to add it to a 'blank CR2 using:

-InternalSerialNumber="VC0863533"

I end up with


InternalSerialNumber = VC0863


Why are the last three digits removed (or rather, not added)?
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 24, 2016, 08:09:15 AM
I tried this with a CR2 from an EOS 80D and it doesn't show this problem.  What model are you using?

> exiftool a.cr2 -internalserialnumber=VC0863533
    1 image files updated
> exiftool a.cr2 -internalserialnumber -model
Internal Serial Number          : VC0863533
Camera Model Name               : Canon EOS 80D


- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 24, 2016, 08:34:53 AM
I have multipe bodies, including 700D, 5D3, 6D and 7D2.

I just checked: For 7D2, T2i, T3i, T4i, T5i, T6i and 6D  it does work.
It seems the only camera for which it doesn't work is the 5D III. Would you mind to check if I upload a raw file and place the link here?
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 24, 2016, 08:50:18 AM
Ah, right.  For the 5DmkIII the InternalSerialNumber is part of a binary data block (called SerialInfo by ExifTool).  This data block is only large enough for a 6-character serial number.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 24, 2016, 08:54:41 AM
I see :)
What is the difference between InternalSerialNumber and LensSerialNumberr?

How is the InternalSerialNumber stored in CR2's from the 5Ds(r)?
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 24, 2016, 08:57:02 AM
InternalSerialNumber is presumably related to part of the camera.  I don't know what part, but not the lens I think.

In most models this is a simple string.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 24, 2016, 09:07:10 AM
I see. Google provided me with a 5DS , 1DX and 1DXmkII sample CR2 file and I checked. 1DX and 1DXII work fine, but 5DS InternalSerialNumber is also limited to six digits.
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 25, 2016, 04:50:35 AM
I thought I managed to add a new -MacroMagnification tag to my CR2 files, but now I keep getting errors.


"C:\ExifTool\exiftool.exe" -wm wcg -MacroMagnification="9.7" -m -overwrite_original_in_place -P -srcfile %%d%%f.CR2 -r K:\z -v0 > T:\exiflog.txt


Outputs:

Warning: Not creating MacroMagnification


If I try to modify the tag in a file where it already exists, the value does change, but not to the one I specified. Some examples:

6.3 -> 6.16884330163176
7.3 -> 7.21000370088664
8.3 -> 8.42688828763869
9.3 -> 9.34021798848996
9.7 -> 9.84915530675933

It doesn't make a difference if I add the -n argument.

How do I create the new tag and add the proper value?
Help?  ;D
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 25, 2016, 08:02:41 AM
You can't add or delete makernote tags from an image.  Is this a new makernote tag you are trying to add?

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 25, 2016, 09:17:07 AM
In exiftoolgui, "MacroMagnification" is listed under MakerNotes. However, I'm pretty confident that I have added the tag to a (I think 5D III) raw file that was created without a lens attached to the body. If the MP-E65 is attached, the tag is already there in the raw file, so it should also be possible to add it with exiftool, right?

-Update: if I choose in Exiftoolgui "Copy metadata from single file" with a no-lens-attached-CR2 selected and choose an "MP-E-CR2" and choose to copy *all* exif information or only the makernote tags, it works fine.

What I'd like to do, is only add the MacroMagnification tag without adding or modifying all the other tags.
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 25, 2016, 02:12:14 PM
Sorry, this can't be done.  From the exiftool application documentation:

           2) In general, MakerNotes tags are considered "Permanent", and may
            be edited but not created or deleted individually.  This avoids
            many potential problems, including the inevitable compatibility
            problems with OEM software which may be very inflexible about the
            information it expects to find in the maker notes.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 25, 2016, 02:22:16 PM
 :(

Is there a safe & quick way to copy all metadata into a new raw file and then change back everything that was already there (e.g. date, time, lensinfo, etc.) and leave the MacroMagnification tag intact?

I did a comparison with two raw's from the same camera but with a different lens (135L vs MP-E). Some tags that may be quite important are different, but these ones can also be changed back to their original values, right?

The ones that look important for the rest of the raw file are:
Preview Image Start
Sub Sec Time
Sub Sec Time Original
Sub Sec Time Digitized
Thumbnail Offset
Strip Offsets
File Index

Also, as  "perminant backup" I'd like to keep the entire exif block from each original, unmodified raw as an .exif file. In exiftoolgui there's an option to create these .exif files from all raw's in a single directory. I'm struggling to get it to work from the command line, so I can do it recursively for many directories at ones.
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 25, 2016, 10:11:36 PM
I would have to answer "no" to that question.  There is just far too much as-yet-unknown metadata in RAW files.

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 26, 2016, 06:00:44 AM
Quote from: Phil Harvey on June 25, 2016, 10:11:36 PM
I would have to answer "no" to that question.  There is just far too much as-yet-unknown metadata in RAW files.

- Phil

Oke. But how do I extract all the exif data als an .exif file. In exiftoolGUI there is an option in the menu, but it works only for a single directory. I'd like to do it recursively and cannot find it in the manual or with google.
Title: Re: Update LensType and LensID fields
Post by: Phil Harvey on June 26, 2016, 07:02:48 AM
There are various ways to do this.  Here is one:

exiftool -o %d%f.exif -r DIR

- Phil
Title: Re: Update LensType and LensID fields
Post by: niels123 on June 26, 2016, 07:54:36 AM
Thanks a lot for the great help!  ;D