Question regarding the -JSON output and val/num

Started by Mac2, November 21, 2021, 07:22:22 AM

Previous topic - Next topic

Mac2

Depending on the tag and data type, ExifTool usually outputs (both for -X and -JSON) a val (formatted) and/or num value.
For some tags, however, I don't see any reason to output both, because val and num are identical. For example XMP::xmpMM::XMP:History or XMP::iptcExt:XMP:LocationShown. At least these are the two tags I've found so far.

Example:
    "XMP:LocationShown": {
      "desc": "Location Shown",
      "id": "LocationShown",
      "num": [
        {
          "City": "Frankfurt am Main",
          "CountryName": "Germany",
          "ProvinceState": "Hessen",
          "Sublocation": "Gutleutviertel"
        }
      ],
      "table": "XMP::iptcExt",
      "val": [
        {
          "City": "Frankfurt am Main",
          "CountryName": "Germany",
          "ProvinceState": "Hessen",
          "Sublocation": "Gutleutviertel"
        }
      ]
    },


Is there a reason for this or is this just a glitch?
I'm currently rewriting my ExifTool -> Database import routine and I wonder if I should import both data sets in such cases (because, one day, there may be different contents in val and num...).

Also: Different data type used for num for the same tag (in different groups):

    "EXIF:YCbCrSubSampling": {
      "desc": "Y Cb Cr Sub Sampling",
      "num": "2 2",
      "table": "Exif::Main",
      "val": "YCbCr4:2:0 (2 2)"
    },


but

    "XMP:YCbCrSubSampling": {
      "desc": "Y Cb Cr Sub Sampling",
      "num": [
        2,
        2
      ],
      "table": "XMP::tiff",
      "val": "YCbCr4:2:0 (2 2)"
    },


In the first case num contains a string with numbers separated by a blank, in the second case num is an array with two numbers.
Why are two different data types used, and when? I would like to unify the numeric representation in my database for these cases.

Phil Harvey

Right.  Structures weren't being tested to see if they were equal.  I'll fix this in the next version.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Mac2

Cool! Thanks  :)

And the string vs array difference?

Phil Harvey

Sorry, I didn't read that far.

That difference I can't fix.  All multi-valued integer EXIF tags are returned as a string of space-delimited numbers.  In XMP these are typically stored in some sort of list, but not always.  It would break things badly if I started returning multi-valued EXIF tags in list form.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Mac2

Thanks for explaining. I can live with that, I was just wondering.
I will unify this somehow when I import the data into the database.