How to add an operator to a metadata variable

Started by altae, April 17, 2018, 01:16:14 PM

Previous topic - Next topic

altae

I'm trying to add a metadata template that inserts the correct value for the 35 mm equivalent (focal length) based on the focal length value of my APS-C camera. How do I add a mathematical operator like multiply to a variable in order to calculate the 35 mm focal length equivalent?

Mario

You cannot do maths with variables. All possible operations and functions are explained in the help: https://www.photools.com/help/imatch/#var_basics.htm
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

altae

Too bad, guess I have to calculate it manually then. But that would be a really handy feature.

Mario

There are limits, even for IMatch.
Variables are an extremely powerful and versatile concepts. From this and your previous posts I understand that you are trying out of the ordinary things.
And for that, probably a custom IMatch app would be the best way to do it.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: altae on April 17, 2018, 01:58:54 PM
Too bad, guess I have to calculate it manually then. But that would be a really handy feature.

I agree.
Because IMatch is so powerful and also variables, I thought at least the basic arithmetic with variables would be cool.
But well, even IMatch has its limits.

I hope you find a good way to do what you want.
Best wishes from Switzerland! :-)
Markus

altae

Out of the ordinary? Not really. Imatch shows a value for the 35 mm focal length equivalent in the metadata panel but it's all wrong for my camera (Canon APS-C camera). All I am trying to do is fixing that value. And for this a template that multiplies the focal lenght of the lens times 1.6 would be the simplest solution. Please take a look at the attached screenshot. A 10 mm lens on a Canon crop camera is by no means equivalent to a 68.5 mm focal length on a full frame camera. That's all I'm trying to fix here and if possible I'd like to do that without having to manually calculate and enter the correct value for every photo.

Mario

Quote from: sinus on April 17, 2018, 02:12:24 PM
Because IMatch is so powerful and also variables, I thought at least the basic arithmetic with variables would be cool.
I have an old list somewhere which lists at least 30 critical points and special cases to handle when using math with variables. And many new ways for variables to fail or to behave badly. And, I doubt that there are more than a handful users out there which would need to perform calculations with variables.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

#7
Quote from: altae on April 17, 2018, 02:36:01 PM
Out of the ordinary? Not really. Imatch shows a value for the 35 mm focal length equivalent in the metadata panel but it's all wrong for my camera (Canon APS-C camera). All I am trying to do is fixing that value. And for this a template that multiplies the focal lenght of the lens times 1.6 would be the simplest solution. Please take a look at the attached screenshot. A 10 mm lens on a Canon crop camera is by no means equivalent to a 68.5 mm focal length on a full frame camera. That's all I'm trying to fix here and if possible I'd like to do that without having to manually calculate and enter the correct value for every photo.

IMatch shows the values reported / calculated by ExifTool.
There is usually a focal length value, and a 35 mm equiv. focal length value that is calculated by the camera and written to the EXIF record.
If both values are wrong in the EXIF data produced by your device, I would rather think that the camera vendor is responsible.

{File.MD.Exif::Main\37386\FocalLength\0}

Definition from the EXIF standard: The actual focal length of the lens, in mm. Conversion is not made to the focal length of a 35 mm film

{File.MD.Exif::Main\41989\FocalLengthIn35mmFormat\0}

EXIF standard: This tag indicates the equivalent focal length assuming a 35mm film camera, in mm. A value of 0 means the focal length is unknown. Note that this tag differs from the FocalLength tag.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

altae

Maybe the camera is to blame, maybe one of the various tools I use to process my photos (it's not uncommon for tools like Photomatix or Aurora HDR to mess up exif data). Sure I could write to the corresponding companies asking them to fix the issue. But they would probably tell me that someone else is responsible and advise me to simply use a tag editor to fix it  ;) Anyways, it would have been handy but since it's not possible I am going to correct the values manually.

zematima

Maybe I am wrong, but in the Attributes is it possible to do such operation?
Field A with the metadata value, field B with 1.6 and a field C with the value of field A*field B.
I think Sinus has something like that to calculate values.

sinus

Quote from: zematima on April 17, 2018, 06:16:51 PM
Maybe I am wrong, but in the Attributes is it possible to do such operation?
Field A with the metadata value, field B with 1.6 and a field C with the value of field A*field B.
I think Sinus has something like that to calculate values.

Zematima,
I wished it would be like you wrote.
As far as I know, also Attributes-fields cannot calculate.
Except if ONE file has several attributes-entries (one line "sum 100.-- the next line 200.--) then there are two variables (I believe):
sum and avg to get the total of these fields of one file and the average.

But if you have 2 or more files, a calculation is not possible.

My possibility to calculate with attributes-fields exists because Thorsten (with inputs from Andy) have programmed an app that does exactly that:
Calculating with attribute fields.

And then these values are written back into Attibutes fields.
So only the app does arithmetic.

That's great for me, but it's also difficult. Because if I only want to change something in the script, then I can do it rarely, because the script is complicated (for me).

Of course, it would be much easier if you could calculate with certain attribute fields. Or use variables for it.
Mario says that such a possibility of calculation is not interesting for many users.
That's possible, I have no idea.
But if it were possible, users might be able to do a lot with it. Something like the thread creator asked would be peanuts.

I think for all these people who calculate certain numbers (as mentioned in the IMatch help):

Record sales data for your files. 
Track submissions of your photos or other files


it would also be interesting for these people to be able to do at least the basic arithmetic.

But I don't know how many people there are and maybe Mario is right that this would only be a small part of the users.

I believe what I have written here is correct. But I'm still not 100% sure.  ;D 8)




Best wishes from Switzerland! :-)
Markus

altae

Is there a way to circumvent this limitation by importing metadata? This way I could export the metadata (actually I only need 3 fields), change the corresponding values for the 2 fields in question in a text file and import the data again.

Mario

#12
Text Export => CSV => CSV Importer => Database.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

altae


altae

I've decided to revive this thread in order to thank you for introducing basic mathematical functions to IMatch 2018. This is exactly what I was looking for. ☺ 👍

Mario

Very well. They are simple but can actually solve a lot of problems users faced in the past.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

altae

Exactly. I doubt that there is much demand for advanced mathematical functions. The basics are enough to solve the most common problems. For example I created a template that adds the desired "Focal length 35 mm equivalent" based on the exif value for "focal length" to all selected photos. Simple functionality but it saves a lot of time.

sinus

Quote from: altae on August 31, 2018, 05:30:04 AM
Exactly. I doubt that there is much demand for advanced mathematical functions. The basics are enough to solve the most common problems. For example I created a template that adds the desired "Focal length 35 mm equivalent" based on the exif value for "focal length" to all selected photos. Simple functionality but it saves a lot of time.

Yes, I agree fully, sometimes some small mathematical functions can solve a "big" problem. I liked it also, this math stuff.
Best wishes from Switzerland! :-)
Markus