Update/Save IPTC tags in Jpeg

Hello. My name is Yuri. I’m using GroupDocs.Metadata suite and I have a problem. While I’m saving with commands


jpegFormat.UpdateIptc(iptc);
jpegFormat.Save();

i’ve got an error “Could not update metadata. Evaluation only”. I know that this issue has been shown because of trial license. How can I fix it? Help me please. Thanks a lot. Yuri.


Now I dowloaded version 1.7.0 and this error has dissappeared but this piece of code

var fileStream = File.Open(“11.jpg”, FileMode.Open, FileAccess.ReadWrite);
JpegFormat jpegFormat = new JpegFormat(fileStream);
var iptc = jpegFormat.GetIptc();
iptc.RemoveAt(4);
var property = new IptcProperty(4, “City”, 90, “mountain”);
iptc.Add(property);
fileStream = File.Open(“11.jpg”, FileMode.Open, FileAccess.ReadWrite);
jpegFormat.UpdateIptc(iptc);
jpegFormat.Save(fileStream);

doesn’t save IPTC tags. What is my mistake? Thanks

Hi Yuri,

Thanks for using GroupDocs.Metadata for .NET

GroupDocs.Metadata
is a totally back-end UI independent API that is fully capable of
handling metadata of a document. When you use the trial version of the API; you will face some limitations for not all the features are supported for the trial version. For further details about what are the limitations you will face while
using the trial version of the GroupDocs.Metadata API please follow this
link. Once you have a license, you can fetch your requisite properties using the very same code you have been using already.

You can request a temporary
license to test the functionality of GroupDocs.Metadata in full mode.
Please feel free to visit below page for details on getting a temporary
license:
https://www.groupdocs.com/corporate/purchase/purchase-policies/temporary-license

For further details about the features of GroupDocs.Metadata, please go through the API’s documentation.
You can also download the gihub project containing some examples of the API that will help you in understanding the API’s working.

Looking forward to hear from you.

Best Regards,

Now I dowloaded version 1.7.0 and this error has dissappeared but this piece of code

var fileStream = File.Open("11.jpg", FileMode.Open, FileAccess.ReadWrite);
JpegFormat jpegFormat = new JpegFormat(fileStream);
var iptc = jpegFormat.GetIptc();
iptc.RemoveAt(4);
var property = new IptcProperty(4, "City", 90, "mountain");
iptc.Add(property);
fileStream = File.Open("11.jpg", FileMode.Open, FileAccess.ReadWrite);
jpegFormat.UpdateIptc(iptc);
jpegFormat.Save(fileStream);

doesn't save IPTC tags. What is my mistake? Thanks

Now I dowloaded version 1.7.0 and this error has dissappeared but this piece of code

var fileStream = File.Open("11.jpg", FileMode.Open, FileAccess.ReadWrite);
JpegFormat jpegFormat = new JpegFormat(fileStream);
var iptc = jpegFormat.GetIptc();
iptc.RemoveAt(4);
var property = new IptcProperty(4, "City", 90, "mountain");
iptc.Add(property);
fileStream = File.Open("11.jpg", FileMode.Open, FileAccess.ReadWrite);
jpegFormat.UpdateIptc(iptc);
jpegFormat.Save(fileStream);

doesn't save IPTC tags. What is my mistake? Thanks

Hi Yuri,

Please follow this link to see how IPTC metadata is updated in a JPEG file. Moreover I suggest you to run the sample project hosted at github to see how the action is performed there. Please feel free to ask again in case you are not able to resolve the issue.

Best Regards

Thanks for answers. But I still have this problem. I copy piece of code from example page and I copy code from github project, but data still hasn’t saved. Here my piece of code.


using (var fileStream = File.Open(“11.jpg”, FileMode.Open, FileAccess.ReadWrite))
{
JpegFormat jpegFormat = new JpegFormat(fileStream);
var iptc = jpegFormat.GetIptc();
IptcCollection collection = new IptcCollection();
collection.Add(new IptcProperty(2, “category”, 15, “formats”));

collection.Add(new IptcProperty(2, “aurgency”, 10, 5));

jpegFormat.UpdateIptc(collection);
jpegFormat.Save();
}

There are no any error while compiling. Thanks a lot. Yuri

Thanks for answers. But I still have this problem. I copy piece of code from example page and I copy code from github project, but data still hasn’t saved. Here my piece of code.


using (var fileStream = File.Open(“11.jpg”, FileMode.Open, FileAccess.ReadWrite))
{
JpegFormat jpegFormat = new JpegFormat(fileStream);
var iptc = jpegFormat.GetIptc();
IptcCollection collection = new IptcCollection();
collection.Add(new IptcProperty(2, “category”, 15, “formats”));

collection.Add(new IptcProperty(2, “aurgency”, 10, 5));

jpegFormat.UpdateIptc(collection);
jpegFormat.Save();
}

There are no any error while compiling. Thanks a lot. Yuri

Hi Yuri,

I apologize for the inconvenience. The IPTC metadata you are trying to save/update uses IIM(information interchange model) standard. It only accepts a few values. The IptcProperty accepts 4 arguments.Please have a look at the “IIM schema for XMP specifications” section of the following link for the list of valid values to create an IPTC property:
http://www.iptc.org/std/IIM/4.1/specification/IPTC-IIM-Schema4XMP-1.0-spec_1.pdf

You may now see that the IPTC property with name “Urgency” has a data set number of “2” and a “tag id” of value “10”, the possible values it support are ‘1’ is most urgent, ‘5’ normal and ‘8’ denotes the least-urgent copy. ‘0’, ‘9’ reserved for future use. So, a valid IPTC property may be written as follows:
IptcProperty property = new IptcProperty(2, “urgency”, 10, 5)

Similarly you can find other properties from the above mentioned document as well.

In case the issue persists, you can also update the IPTC metadata using XMP API. Please have a look at the following link to know more about using the XMP API to update a photo’s IPTC metadata.
Working with XMP metadata | Documentation

Let us know in case you find something ambiguous.
Best Regards

Thanks for answer. I try to use XMPWrapper but I have an exception:


GroupDocs.Metadata.Exceptions.GroupDocsException: 'Could not update metadata in evaluation mode’

Can I update data in this way?
Thanks, Yuri.

And I noticed that following simple piece of code doesn’t save changes:


JpegFormat jpegFormat = new JpegFormat(“11.jpg”);
var iptc = jpegFormat.GetIptc();
iptc.Add(new IptcProperty(2, “urgency”, 10, 5));
jpegFormat.UpdateIptc(iptc);
jpegFormat.Save();
Is this problem tied up with evaluate copy of tihs product? And one more question: is it possible to save change (like iptc or exif data) in evaluation copy of product?

Thanks a lot! Yuri

Hi Yury,

You cannot update the metadata in Evaluation mode for the GroupDocs.Metadata API doesn’t allow updating the IPTC metadata in trial mode.
You can request a temporary
license to test the functionality of GroupDocs.Metadata in full mode.
Please feel free to visit below page for details on getting a temporary
license:
https://www.groupdocs.com/corporate/purchase/purchase-policies/temporary-license
In case you have got a temporary license, you first need to apply it in your project. Please have a look at the following link to see how to apply a license:
https://docs.asposeptyltd.com/display/metadatanet/Working+with+Common+Utilities#WorkingwithCommonUtilities-ApplyLicense

Let us know in case of any issue.


Best Regards,

Thanks for the answer. I’ve already made these steps for getting temporary license, but license haven’t been come to me (email: fordv12qt@outlook.com), there are no any letters in both inbox and spam folders. Can you send me again? Thanks a lot. Yuri

Hi Yuri,

We apologize for the inconvenience. If you haven’t received the mail yet; not even in your spam folder, kindly let us know and we’ll update you accordingly.

Best Regards,