Page 1 of 1

Parser for metadata returned by Identify

Posted: 2013-03-15T02:53:18-07:00
by Constantinos
If the fields that could be returned are only the ones shown here

http://www.imagemagick.org/script/identify.php

then a parser is not something difficult.

However, if there are more and their names are not known in advance and the metadata tree is 3 levels deep (ie like

Channel statistics:
red:
min: 37 (0.145098)
max: 255 (1)

in more parts, then there is the problem of no clear delineation of where the third level of the tree for a branch finishes and the branching goes back to the second level.

Ie if we have for arbitrary fields

Element 1:<stuff>
Group A:
element a: <stuff>
subgroup a1:
element a1a: <stuff>
element a1b: <stuff>
element a1c: <stuff>
Group B:

there is no way to know where subgroup a1 closes, thus we cannot know ie whether element a1c is in Group A-subgroup a1 or on the top level of Group A. In the example onthe link, there are no tabs or anything else to delineate where a group ends.

Due to the above, I cannot rely on syntax of the input of the parser to make the parser, and I have to rely on semantics for some fields, namely the exact names of the fields.

Is there an exact definition of what identify can possibly return?

Constantinos