Empty array element in Structure Tag

Started by Curtis, December 17, 2015, 03:40:52 PM

Previous topic - Next topic

Curtis

Is it possible to have a completely empty element (for a place holder, later to be filled in) of an array in a structured tag?

So far in my program I have tried:

RegionInfo={
    AppliedToDimensions={H=3000,Unit=pixel,W=4000},
    RegionList=[ 
         {Area={H=0.448333,Unit=normalized,W=0.28,X=0.7145,Y=0.479167},Name=John,Type=Face},
         {},
         {Area={H=0.413333,Unit=normalized,W=0.259,X=0.4075,Y=0.49},Name=Curtis,Type=Face}
         ]}


and
RegionInfo={
    AppliedToDimensions={H=3000,Unit=pixel,W=4000},
    RegionList=[ 
         {Area={H=0.448333,Unit=normalized,W=0.28,X=0.7145,Y=0.479167},Name=John,Type=Face},
         ,
         {Area={H=0.413333,Unit=normalized,W=0.259,X=0.4075,Y=0.49},Name=Curtis,Type=Face}
         ]}



Neither of these work. All works fine if I leave out the {},  or the extra ,  but of course I just get 2 elements instead of the desired 3.

Thanks for any help!
Curtis

Phil Harvey

#1
Hi Curtis,

There is currently no way to write an empty structure or list item with ExifTool.  I suggest you add an entry something like this to fill in the gaps: {Name=placeholder2}

- Phil

Edit: I've been toying with adding the ability to write empty structures, but frankly this scares me a bit because even though they are allowed by the XMP specification, I have never seen them in the wild, and I wonder how other software would react to them.  I have a working version that implements this right now, but want to test it out further.  With this version, the attached XMP is created from either of your examples above.  It would be very useful if you could test out this XMP with any software that you are using to see if it behaves as expected.  Thanks.
...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 ($).

Curtis

Hi Phil,

I tried it out and it works in my program as expected (see attached screen shot). 

I understand the reluctance to allow completely empty elements, but considering as it is currently, all but one of the element members could be empty, then right now programs have to handle that any of the element members could be empty, it is not too much of a jump to say all could be empty.   

This is not a critical feature for me to have, but I ran across the problem when implementing my editor to handle Structure tags with arrays.  Since I had a way to insert new elements (and all being initially empty) there was nothing in my program preventing the user from saving the tag at that point with all members of an array element empty.  I could always put a check in to require the user have a value in at least one of the element members.

Initially I thought I just didn't know the correct syntax for writing a Structure Tag with a completely empty element.  Now I know the current version of exiftool does not support that.

I can make it work either way, just needed to know if it was possible or if I was just missing something.

It does seem it would make exiftool 'more robust', but as you said other programs may have issues with it.

Let me know what you decide and I will program for that.

Thanks again as always!
Curtis


Phil Harvey

Hi Curtis,

I have run some tests here, and Photoshop at least doesn't seem to balk at the empty structure.  I still need to do some tests, but I'm leaning towards keeping this feature.  So unless you hear otherwise from me, expect ExifTool 10.08 to have the ability to write empty XMP structures.

- 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 ($).

Curtis

Thanks Phil!

What would then be the correct syntax for writing a Structured tag with an empty element?  Like the first or second of my examples in the original post, or something else?

Curtis

Phil Harvey

Hi Curtis,

Your examples wrote empty structures (not empty structure elements), and both examples work with my test version of Exiftool.  Writing an empty element could be done with older versions of ExifTool, and the syntax is like this: {Name=}

- 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 ($).

Curtis

#6
OK, but isn't each of the empty Structures I wrote an element of the RegionList Structure that is a Bag (array)?  Would either or both of the examples I gave work as shown to write an empty element (which is a structure) in the RegionList array?

Curtis

PS My terminology, maybe not correct, is as an example, I think of Name as a member of the  Element Structure (of the RegionList array) or in other words RegionList contains elements (which in this case are Structures which contain Members which Name is one of these Members).  Is that right??

Edit:  Reading your documentation I see I should be using the name Field instead of Member, and List instead of Array, and List Item instead of array element.   

Still bottom line, would either or both of my examples in original post work with ver 10.08?

Phil Harvey

Yes.  Both of your examples will work.

- 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 ($).

Curtis

Thanks Phil!   :)  I will check it out in 10.08 when it comes out.

Curtis