Search code examples
c#metadata-extractor

Cannot get Metadata Extractor to run


This is probably an embarrassing question (sorry!): I just installed Metadata Extractor via NuGet without any problem. However, in

    using MetadataExtractor;    

     ...

    Metadata metadata = ImageMetadataReader.readMetadata(file); 

VisualStudio (2015) tells me that the type or namespace for Metadata cannot be found and that ImageMetadataReader does not contain a definition for readMetadata. Thought these were all defined within the Metadata Extractor class. What am I missing?


Solution

  • It looks like you based your code on the Java sample on the website. Check out the C# one instead.

    Function names are case sensitive. readMetadata does not exist.

    Carefully check the return value of ImageMetadataReader.ReadMetadata() and I think you will see the issue. If you mouse over it in Visual Studio, it should show you that it returns an IReadOnlyList<MetadataExtractor.Directory> object.