metadata-extractor-dotnet
metadata-extractor-dotnet copied to clipboard
Support editing metadata
Hi, this looks fantastic. Can it also edit and save metadata to files? Or just read? If not, can you recommend any c# library for writing metadata? (description, comments, tags) Thnaks
No support for writing metadata at this stage. Hopefully one day, but there is no ETA for this.
As for other options I can not make any recommendations. If you find anything, please do report back on this issue. Thanks!
One option could be to write back to an XMP file, and perhaps add support to read from the XMP semi-automatically (i.e. where platforms support interrogating the file system, and the method overload allows)?
Hi folks, I have a working implementation for writing XMP metadata. There are a few things required in XmpCore too, so I am creating several pull requests...
- PR15 on XmpCore > addition of two methods to XmpCore.XMPMetaFactory and XmpCore.Impl.XmpMetaParser
- PR #65 > addition of XDocument Root property to MetadataExtractor.Formats.Xmp.XmpDirectory and two lines in MetadataExtractor.Formats.Xmp.XmpReader.Extract, addition of MetadataExtractor.ImageMetadataWriter and MetadataExtractor.Formats.Jpeg.JpegMetadataSubstitutor for substituting XMP in existing Jpeg files
Please note that my implementation works at the level of the XDocument.
I'm looking forward to depend my project on the NuGet packages again when all of this is merged...
cheers, Michael
Is there any updates on PR #65 ? I also need to write (or rather delete) some XMP metadata, and I have not been able to achieve this. In Python with libxmp, I can do this:
if xmp.does_property_exist(ns, u'property'):
xmp.delete_property(ns, u'property')
# save stripped XMP header to original image
if xmpfile.can_put_xmp(xmp):
xmpfile.put_xmp(xmp)
xmpfile.close_file()
Is this possible with XMPCore? How do you access the metadata as a xdoc? I've tried this but is failing:
XDocument file = XDocument.Load(filename);
var xmpMeta = XmpMetaFactory.ParseFromXDocument(file);
PR #65 is waiting for @drewnoakes to be merged (and the NuGet package updated). Then you will be able to substitute the original XMP metadata with modified (or in your case empty) XDocuments.
It's been three years, any news on that?
Checking once again, any news?
This is a huge feature. I will spare you all the suspense, it's not coming soon and if/when it does come, it'll be broadly announced. There are other tasks we need to complete before we can consider supporting editing metadata.
For those wondering, TagLib# supports writing tags, but it's not regularly maintained and seems a bit finicky
If somebody wants to pick up #65 - I've been using this branch without any problems or broken files for years. When somebody picks it up let me know and I will double check that it's fully up to date and so on.
@michaelosthege I have been looking at testing your PR (#65) against a use case I have for writing xmp to jpeg. The changes for MDE 2.9.0-rc1 will require refreshing the code to address the change to XmpReader.JpegSegmentPreamble (as per #376 ).
Idea/Suggestion/A shot in the dark:
I complied your PR to a standalone library and tested with some test cases that you had added. The only real change, to do so, was changing JpegSegment class to JpegSegmentPlugin (since it had conflicts with the MDE main branch). Have you considered releasing this as a plugin to the MDE? The idea being, if it is a plugin, it could be tested by folks that are interested in writing capability without any impact on MDE? Perhaps at some point down the line, it could be merged into MDE?
@ahsanaman92 it's been ages since I touched that code. The idea with a plugin sounds great, and since you seem to know more much about MDE (and my changes) please feel free to push forward!