GroupDocsGists
10/19/2017 - 11:20 AM

GetIPTCPhotoMetadataFromXMP.cs

// For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
// get xmp metadata
XmpPacketWrapper xmpWrapper = MetadataUtility.ExtractXmpPackage(Common.MapSourceFilePath(filePath));

if (xmpWrapper == null)
{
    xmpWrapper = new XmpPacketWrapper();
}

// add iptc4xmpcore if not exist
if (!xmpWrapper.ContainsPackage(Namespaces.Iptc4XmpCore))
{
    xmpWrapper.AddPackage(new IptcCorePackage());
}

// get iptc4XmpCore package
IptcCorePackage iptcCorePackage = (IptcCorePackage)xmpWrapper.GetPackage(Namespaces.Iptc4XmpCore);

Console.WriteLine("Country Code: {0}", iptcCorePackage.CountryCode);
Console.WriteLine("Sub Location: {0}", iptcCorePackage.Sublocation);
Console.WriteLine("Intellectual Genre: {0}", iptcCorePackage.IntellectualGenre);