ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: victorengel on October 02, 2022, 04:40:32 PM

Title: Magnification missing from R5 Files?
Post by: victorengel on October 02, 2022, 04:40:32 PM
The magnification value reported by the MP-E 65mm lens to Canon cameras is reported in Exiftool for some files, but it seems it is not being reported for files from Canon R5, at least with 100mm RF Macro lens.

As it happens, I have an iOS app that I've been using that calculates magnification from the magnification value for the MP-E 65mm lens, and it's decently accurate. The 100mm RF Macro lens is a new lens for me, so I thought I'd run some tests to calibrate the app for when I use that lens. Boy was I surprised when grepping magnification from exiftool output produced nothing. I ran the same files through my app, and lo and behold, the values are there, in the same format as before. So not sure why Exiftool is not reporting it. I understand not reporting CR3 data, since that's a different format, but the jpeg file uses the very same format.

I've done a VERY preliminary run, and it looks like here is a first approximation to the calculation.

Magnification = MagVal * 0.049 - 6.2043

For example, when the lens is focused at minimum focus distance, MagVal is 156. Specifications say maximum magnification is 1.4x. The value from the above formula is 1.4397. Fitting a curve from experimental data, I get a measured value of 1.417. Probably 2 digits of precision are appropriate for high magnification. Precision drops off as magnification decreases. The values are probably not very useful for magnifications below 0.5x

I'll gather more precise data in a subsequent test and update here if anyone is interested. Meanwhile, it would be good if exiftool would report the raw data that is actually in EXIF.
Title: Re: Magnification missing from R5 Files?
Post by: Phil Harvey on October 02, 2022, 04:58:33 PM
It seems you are talking about the ExifTool Canon:MacroMagnification tag.  This tag is in a different location for each type of camera, and the values are different for each lens.  You can use the ExifTool -U option to see the raw value for this tag if it isn't extracted for your camera/lens combination, but this will also extract a ton of other unknown stuff.  For most models the tag seems to be at offset 0x1b in the CameraInfo.  The current definition for the MP-E 65mm lens does some scaling of the value (using a log relationship).  Here is the code for that tag definition in ExifTool:

my %ciMacroMagnification = (
    Name => 'MacroMagnification',
    Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
    Condition => '$$self{LensType} and $$self{LensType} == 124',
    # 75=1x, 44=5x, log relationship
    ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
    ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
    PrintConv => 'sprintf("%.1fx",$val)',
    PrintConvInv => '$val=~s/\s*x//; $val',
);

If you can provide details about how this should be reported for other lenses then I can add this to ExifTool.

- Phil
Title: Re: Magnification missing from R5 Files?
Post by: victorengel on October 02, 2022, 05:41:37 PM
Oh, I see. Macro Magnification is calculated, and the raw data is not displayed, unless I just missed it, for MP-E 65. I was remembering wrong. I thought both were displayed for the MP-E lens and only internal value displayed for other lenses. I've been looking at the data directly using my own parser. My formula for the MP-E 65 is slightly different from yours since I calibrated using my own lens, but it's close.

The way I'm parsing works consistently for Jpegs from either camera/lens, so I expected exiftool to also be consistent for jpeg. I thought the raw value was being displayed but I guess I remembered wrong. I'm using jpeg now for the R5 because I've not written a parse for CR3, which is completely different from the CR2 format (which I did write a parser for).

It looks like the raw data is being reported with -U option as "Canon File Info 0x0010" for the R5.

Anyway, it's been a while since I've looked at the code, so feel free to ignore my post for now, and thanks for the quick response.

I've also found the data to be marginally useful for a couple of other lenses as well, but only for very close focusing. Beyond that, the precision is not great enough to be useful.