drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load common properties after calling ReadMetadata

taurenshaman opened this issue · comments

commented

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.
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 ❤❤❤

Thanks for your feature request. This is very similar in spirit to drewnoakes/metadata-extractor#10.

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

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();