drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
934 stars 165 forks source link

Load common properties after calling ReadMetadata #278

Open taurenshaman opened 3 years ago

taurenshaman commented 3 years ago

There are some commonly used properties for images, ref:

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

drewnoakes commented 3 years ago

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

arnvanhoutte commented 3 years ago

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

vpenades commented 2 years ago

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