drewnoakes / xmp-core-dotnet Goto Github PK
View Code? Open in Web Editor NEW.NET library for working with the Extensible Metadata Platform (XMP)
.NET library for working with the Extensible Metadata Platform (XMP)
Probably using appveyor.
Currently this library uses .NET 4.0.
MetadataExtractor for .NET is working to support .NET 3.5 and would require this library to do the same.
I think the title explains it quite good. I get an exception:
HResult=0x80004002
Message=Unable to cast object of type 'System.Xml.Linq.XComment' to type 'System.Xml.Linq.XElement'.
Source=XmpCore.StrongName
StackTrace:
at XmpCore.Impl.ParseRdf.Rdf_NodeElementList(XmpMeta xmp, XmpNode xmpParent, XElement rdfRdfNode, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.ParseXmlDoc(XDocument document, ParseOptions options)
at XXX.cs:line 44
at XXX.Test.cs:line 116
This will probably also be true for other similar XNodes (processing instruction, ...?)
Adobe has released a new XMP Toolkit:
http://www.adobe.com/devnet/xmp.html
Do you want to support the latest? Would it replace the current 'master' codebase, or should it live as another permanent branch so the current remains available?
I'm happy to try and start support, although there's no way of knowing how long it might take. Thanks
In version 1.2.2 the project URL was populated, however since 2.0.0 it's been missing.
As described in detail here: drewnoakes/metadata-extractor-dotnet#418 by @Numpsy and confirmed by @kwhopper, it seems like there's a bug from the java import of xmp-core-dotnet, where, if rdf namespace definition is attached to the <x:xmpmeta node (correct behaviour as per C++ version of XMP-toolkit-sdk) rather than the rdf:RDF node (the way xmp-core-dotnet expects it but is incorrect behaviour), xmp-core-dotnet throws an error
Is there any plans to support UTF-16 and UTF-32 encoded XMP metadata?
This library is perfect for my use except for the support of these encodings.
Hi,
I've been doing some testing with reading and modifying some existing XMP, and then converting back to a string with XmpMetaFactory.SerializeToString
and it appears to me as though the the returned string has a BOM at the start?
I noticed because If I try to convert the XMP to a string and then parse that straight back with XmpMetaFactory.ParseFromString then this happens:
And then the first character is this:
and if I trim out the first character then the parse works.
Is this correct?
Thanks.
Some users (drewnoakes/metadata-extractor-dotnet#49) require strong names on assemblies.
https://www.nuget.org/packages/XmpCore/2.0.0-rc6
There's no actual reference to that lib in the DLL.
This class assigns one byte array per character in the input XML which is terribly inneficient.
Hi there,
System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.
I'm trying to use XMPCore.net inside a PCL, and get the above error when using XmpCore.Portable.
I've successfully integrated it into a normal C# library and have several unit tests with accompanying test documents containing XMP. They work just fine with the 'regular' XmpCore.
However when reusing the same code, unit tests and sample documents I get an XML Error with the Portable XMPCore when trying to parse the XMP (from string or buffer). The XMP verifies just fine on w3c and indeed is successfully parsed using non portable XMPCore.
I've tried registering the namespace before parsing with no luck, any ideas?
Thanks for any help,
Chris
XmpProperty682 currently always returns null for the Language property even when an xml:lang qualifier is present and the Options flag HasLanguage is true. I ran into this trying to enumerate the localization languages available for descriptions, copyrights, etc. Using XmpMeta.GetArrayItem to enumerate the localized text entries returns XmpProperty682 properties. XmpMeta.GetLocalizedText is the only way to get an XmpProperty407 property, which requires knowing what the Language will be.
It would seem all XmpProperty682.Language would have to do is test the Options.HasLanguage flag to either return the same value as XmpProperty407 or null as it does now.
...Jim Hansen
I can't find anything online on how to create an array of structs.
There is AppendArrayItem
, but it takes a string
as it's value, but I need it to be the actual struct. How do you make that work?
Thanks!
MissingMethodException: Method not found: 'System.Xml.XmlReaderSettings.set_MaxCharactersFromEntities'.
XmpCore.Impl.XmpMetaParser.ParseXmlFromByteBuffer (XmpCore.Impl.ByteBuffer buffer, XmpCore.Options.ParseOptions options)
XmpCore.Impl.XmpMetaParser.Extract (System.Byte[] bytes, XmpCore.Options.ParseOptions options)
XmpCore.XmpMetaFactory.ExtractXDocumentFromBuffer (System.Byte[] buffer, XmpCore.Options.ParseOptions options)
I have a xmlReader.Settings.MaxCharactersFromEntities under Unity3d.
but no System.Xml.XmlReaderSettings.set_MaxCharactersFromEntities AFAIK?
Any clues?
I do a byte[] imageArray = System.IO.File.ReadAllBytes(fullpath);
then simply
xmp = (IXmpMeta)XmpMetaFactory.ExtractXDocumentFromBuffer(imageArray);
foreach (var property in xmp.Properties)
Debug.Log(string.Format("Path={0} Namespace={1} Value={2}",
property.Path, property.Namespace, property.Value));
Is that wrong?
.net 3.5
I also tried just brute forcing the string in like
byte[] imageArray = System.IO.File.ReadAllBytes(fullpath);
XmlDocument docx = Twobob.BrutalXMP.ExtractXmpBytes(imageArray);
xmp = XmpMetaFactory.ParseFromString(docx.OuterXml);
'Where the ExtractXmpBytes is tested as working okay, But I got the same error so... confuzzled
and also xmp = XmpMetaFactory.ParseFromBuffer(imageArray);
fails similarly so I am guessing this is to do with the calls the XmpMetaFactory class is placing internally.
FWIW: xmp = XmpMetaFactory.Create(); does not fail
Dear All,
i wont to write only xmp meta data to any file. we go for lot of R&D but they did not work for me at. all.so it is very urgent,anybody help me..
Hello @drewnoakes,
The license is not available and the link available in the README.md file is broken. I guess the license should be:
https://web.archive.org/web/20120911161309/http://www.adobe.com/devnet/xmp/library/eula-xmp-library-java.html
but I am not sure. Please let me know if the below BSD license version is correct and add a correct one if possible.
The BSD License
Copyright (c) 2009, Adobe Systems Incorporated All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Adobe Systems Incorporated, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The original XMPCore project includes an XMPCoreCoverage
project that would make a good test suite.
Download from here:
http://www.adobe.com/devnet/xmp/library/eula-xmp-library-java.html
Any thoughts on converting this to be usable in a PCL library?
Hello,
I'm trying to use the library to extract metadata from an mp4 file taken with an Android phone. I'm running:
using var stream = File.OpenRead("C:\...\movie.mp4");
var xmp = XmpMetaFactory.Parse(stream);
This fails with:
System.NotSupportedException: UTF-32 is not a supported encoding.
at XmpCore.Impl.ByteBuffer.GetEncoding()
at XmpCore.Impl.Latin1Converter.Convert(ByteBuffer buffer)
at XmpCore.Impl.XmpMetaParser.ParseXmlFromByteBuffer(ByteBuffer buffer, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.ParseXmlFromInputStream(Stream stream, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.Parse(Stream stream, ParseOptions options)
at XmpCore.XmpMetaFactory.Parse(Stream stream, ParseOptions options)
Looking at the code, I saw that this was following the AcceptLatin1
path so I also tried:
var xmp = XmpMetaFactory.Parse(stream, new() { AcceptLatin1 = false });
This fails with:
XmpCore.XmpException: Unsupported Encoding
---> XmpCore.XmpException: XML parsing failure
---> System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(XmlReader reader)
at XmpCore.Impl.XmpMetaParser.ParseStream(Stream stream, ParseOptions options)
--- End of inner exception stack trace ---
at XmpCore.Impl.XmpMetaParser.ParseStream(Stream stream, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.ParseXmlFromByteBuffer(ByteBuffer buffer, ParseOptions options)
--- End of inner exception stack trace ---
at XmpCore.Impl.XmpMetaParser.ParseXmlFromByteBuffer(ByteBuffer buffer, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.ParseXmlFromInputStream(Stream stream, ParseOptions options)
at XmpCore.Impl.XmpMetaParser.Parse(Stream stream, ParseOptions options)
at XmpCore.XmpMetaFactory.Parse(Stream stream, ParseOptions options)
Is there a reason why UTF-32 is not supported? Or is the real issue that the file lacks XMP metadata and this is just a misleading error message?
Any reason that the nuget and assembly version not is the same?
Nuget version: 2.0.1
Assembly version: 5.1.2.0
Last week VS2017 was released along with C# 7.
Does anyone have any reservations about the project upgrading? This would cause the solution to not build under VS2015, however you could still use the NuGet package in earlier version(s) of Visual Studio just fine.
Thanks for the Sample usage example. I have tried this on some files with XMP tags (generated by Picasa), and I get the following exception : "UTF-16 is not a supported encoding.". Do you have any advice on how to overcome this please? (the tags show up ok when checked at: http://exif.regex.info/exif.cgi )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.