metadata-extractor-dotnet icon indicating copy to clipboard operation
metadata-extractor-dotnet copied to clipboard

Load common properties after calling ReadMetadata

Open taurenshaman opened this issue 3 years ago • 3 comments

There are some commonly used properties for images, ref:

  • width, height, dpi
  • Author
  • Title, Comment, Keywords
  • CameraManufacturer
  • DateTaken
  • Copyright
  • Location
  • DateTaken
  • Format
  • Subject
  • Rating

So I hope there will be some helper method to get these properties from IReadOnlyList<Directory>. Example code:

var directories = MetadataExtractor.ImageMetadataReader.ReadMetadata( fileStream );
ImageInfo info = XXXX.Load( directories ); 
// ImageInfo or other name is a struct including properties above.
// or
string author = MetadataExtractor.Utils.ImageInfo.GetAuthor( directories );
int width = MetadataExtractor.Utils.ImageInfo.GetWidth( directories );

Thank you very much ❤❤❤

taurenshaman avatar Jan 20 '21 04:01 taurenshaman

Thanks for your feature request. This is very similar in spirit to https://github.com/drewnoakes/metadata-extractor/issues/10.

drewnoakes avatar Jan 20 '21 08:01 drewnoakes

Yes please! I need to access the copyright tag in my image but the directory I need to look in depends on the extension of the image, which makes it the code really ugly

arnvanhoutte avatar Mar 22 '21 16:03 arnvanhoutte

I would like to know if there's been any update with this issue.

I think it's great to have an API so those that require it can browse into the details of the metadata... but if you just need some common properties, it's forcing everybody to reinvent the wheel into following the same steps to retrieve a given property.

maybe the solution would be to add a LINQ like API that would be implemented like this:

IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(imagePath);

string title = directories.SelectTitles().FirstOrDefault();
string author = directories.SelectAuthors().FirstOrDefault();
GeoLocation loc = directories.SelectGeoLocations().FirstOrDefault();

vpenades avatar May 02 '22 10:05 vpenades