0

I have a program which can read xmp Data in C# but some images have some properties NULL and when I am trying to write xmp data for a NULL property it gives an exception:

Property cannot be found :Exception from HRESULT: 0x88982F40

Is it possible to set values for properties which are NULL?

// Credit Status = Copyrighted
metaData.SetQuery("/xmp/xmpRights:Marked", "True");

//overwriting instructions with static text
metaData.SetQuery("/xmp/photoshop:Instructions", Constants.InstructionsText);

var usageTerms = metaData.GetQuery("/xmp/xmpRights:UsageTerms/x-default");

if (string.IsNullOrEmpty(Convert.ToString(usageTerms)))
    metaData.SetQuery("/xmp/xmpRights:UsageTerms/x-default", Constants.UsageTermText);

Basically i need a script through which i can create a new XMP property in Jpeg?

Kamran Pervaiz
  • 1,861
  • 4
  • 22
  • 42
  • May be helpfull: http://www.howtogeek.com/forum/topic/can-not-remove-jpg-tags-error-0x88982f40 and http://www.digicamhelp.com/camera-logs/random-thoughts/removing-tags-in-vista-windows-photo-gallery/ – Yuliia Ashomok Sep 26 '14 at 08:45
  • Try to get names of the images have which have properties NULL - Whats wrong with this images? – Yuliia Ashomok Sep 26 '14 at 08:47
  • basically i need a script through which i can create an xmp property in Jpeg – Kamran Pervaiz Sep 26 '14 at 09:13
  • http://stackoverflow.com/questions/15758054/adding-custom-namespace-to-metadata-bitmapmetadata this link suggest how to add but i am unable to do for Rights Usage Terms – Kamran Pervaiz Sep 29 '14 at 11:27

1 Answers1

0

I have found a way, I hope it helps! I found the answer on MSDN comments

if (!metadata.ContainsQuery(@"/xmp/photoshop:Instructions"))
     metadata.SetQuery(@"/xmp/{wstr=http://ns.adobe.com/photoshop/1.0/}:Instructions", instructions);
if (metadata.ContainsQuery("/xmp/photoshop:Marked"))
     metadata.SetQuery(@"/xmp/{wstr=http://ns.adobe.com/photoshop/1.0/}:Marked", CreditStatus);
if (metadata.ContainsQuery("/xmp/xmpRights:UsageTerms/x-default"))
{
     metadata.SetQuery(@"/xmp/{wstr=http://ns.adobe.com/xap/1.0/rights/}:UsageTerms",
                                          new BitmapMetadata("xmpalt"));
     metadata.SetQuery(@"/xmp/xmpRights:UsageTerms/x-default", usageTerms);
}
Kamran Pervaiz
  • 1,861
  • 4
  • 22
  • 42