0

I have seen seen several posts regarding this but I could not apply any of them. It's perhaps due to documentation change. I used ImageSharp and System.Drawings. System.Drawings is not supported in .Net Core. Also ImageSharp sample that I found did not work.( I am not a C# expert)

This is what I used to get the metadata using Imagesharp

using (Image<Rgba32> image = Image.Load(input))
{
   var exif = image.MetaData.ExifProfile.GetValue;

   var met = exif.GetValue(SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifTag.ImageDescription);   
}

the problem is that I get null for exif variable ( I am not sure what I am doing wrong). Is there a simple code sample that I can use to do this? I tried to read the doc here https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifProfile.html but I could not figure out how to use it. Any help would be appreciate it.

oatsoda
  • 2,088
  • 2
  • 26
  • 49
jax
  • 840
  • 2
  • 17
  • 35

1 Answers1

1

I think this line is wrong:

var exif = image.MetaData.ExifProfile.GetValue;

Just remove the .GetValue from the end as you are referencing a method here.

So

using (var image = Image.Load(input))
{
   var exif = image.MetaData.ExifProfile;
   var met = exif.GetValue(SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifTag.ImageDescription);
}
oatsoda
  • 2,088
  • 2
  • 26
  • 49