Search code examples
c#metadata-extractor

Exception thrown when reading meta data from .tif file using c# and metadata extractor


I am trying to read the metadata from a .tif file using the Metadata Extractor dll and I keep getting a FileIsNotFoundException. It works fine when I try the same code using a .jpeg file.

FileStream OriginalFile = new FileStream(FullPath, FileMode.Open, FileAccess.Read, FileShare.Read);
IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(OriginalFile);
foreach (var directory in directories)
    foreach (var tag in directory.Tags)
        Console.WriteLine($"{directory.Name} - {tag.Name} = {tag.Description}");

Edit: I re-installed the package and now have the XmpCore.dll inside the packages folder of my project but I still see the same exception as before. Works fine for .jpeg and .psd files.

Exception thrown when trying open a .tiff image


Solution

  • I solved the exception by changing the Copy Local property to True for XmpCore under References in the Solution Explorer.