views:

15

answers:

1

Hello All,

I am using Windows Imaging Component to read/write image metadata in my WPF application. I would like to know if there is an efficient way to know if any paths exist within a namespace. For instance I would like to know if any paths within IPTC namespace exist and if not I want to delete the namespace from the image header.

Any pointers would be greatly appreciated.

Thanks,

Murugesh.

A: 

Get an IWICMetadataQueryReader object and use its GetEnumerator method. With the IEnumString object returned from GetEnumerator, call its Next method to see if at least one metadata exists. If not then the metadata block is empty.

Trying to reach the IPTC namespace from the root query reader might be a bit trickier: the root may refer to the IPTC namespace (metadata block) as a single COM object sitting on the root, then you will need to figure out the type (interface) of that COM object and descend into it, much like exploring a tree.

I think it is typically not possible to control WIC what metadata not to write, as WIC is free to insert its own stuff as long as considered harmless.

rwong