Ask a questionAsk a question
 

QuestionHow to add people tagging metadata

  • Tuesday, October 06, 2009 8:54 PMLi2007 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'm writing people tagging metadata to a jpg file that has yet no xmp block. Here is my code:

    // add padding here already

    ...

    // This works fine as I can see RegionInfo is created with WICExplorer

    bitmapMetadata.SetQuery("/xmp/MP:RegionInfo", new BitmapMetadata("xmpstruct"));

    // This works fine as I can see Regions is created with WICExplorer

    bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions", new BitmapMetadata("xmpbag"));

    // This works fine as I can see 0 (XMP Struct Reader) is created with WICExplorer

    bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}", new BitmapMetadata("xmpstruct"));

    // These two statement give System.AccessViolationException. Why?

    bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}/PersonDisplayName", "somename"));

    bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}/Rectangle", "somerectangle"));

    //...others as... jpegEncoder.Frames.Add(...

    The last two SetQuery() statements are not working. I don't know why? Could you help me out? Thanks!

All Replies