Skip to main content
add optionvalue alternative
Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

This unpacks nested sets of rules:

FilterRules[ Options[i, MetaInformation] //. {_ -> z_} -> z, "XResolution"]

{"XResolution" -> 300}

OptionValue

Here is an interesting alternative which does require some knowledge of the structure of the MetaInformation but is otherwise nicely concise.

OptionValue[Options[i, MetaInformation], MetaInformation -> "Exif" -> "XResolution"]

300

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

This unpacks nested sets of rules:

FilterRules[ Options[i, MetaInformation] //. {_ -> z_} -> z, "XResolution"]

{"XResolution" -> 300}

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

This unpacks nested sets of rules:

FilterRules[ Options[i, MetaInformation] //. {_ -> z_} -> z, "XResolution"]

{"XResolution" -> 300}

OptionValue

Here is an interesting alternative which does require some knowledge of the structure of the MetaInformation but is otherwise nicely concise.

OptionValue[Options[i, MetaInformation], MetaInformation -> "Exif" -> "XResolution"]

300

added 130 characters in body
Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

This unpacks nested sets of rules:

FilterRules[ Options[i, MetaInformation] //. {_ -> z_} -> z, "XResolution"]

{"XResolution" -> 300}

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.

This unpacks nested sets of rules:

FilterRules[ Options[i, MetaInformation] //. {_ -> z_} -> z, "XResolution"]

{"XResolution" -> 300}

Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is something based on FilterRules and using your post of Exif metadata format.

FilterRules["Exif" /. (MetaInformation /. Options[i, MetaInformation]), "XResolution"]

{"XResolution" -> 300}

There may be more elegant ways to extract the rules which form part of MetaInformation, I await them with interest.