Search code examples
c#exif

How to get the Rating of image files from Exif library


I am using EXIFextractor-library-to-extract-EXIF-information.It works fine but my problem is that i want to extract Image rating means (star rating) but in that Exif i don't find any property with Rating or Star name so getting problem that how to get the star rating of Images.

I am using a property to find a rating and sometimes it works fine but many time it's showing me a wrong value.The property is

string rate = ((System.Drawing.Image)((er).bmp)).PropertyItems[1].Value[0].ToString();

So please tell me that how we can achieve Rating value of images.

Example:-

enter image description here

This image is having rating of 3 stars so how to get that value.

Thanks in advance.


Solution

  • Finally i solve my problem.The propertyId for Find Image Rating is 18246 i Just replace my code like

    PropertyItem propItem = er.bmp.GetPropertyItem(18246);
    String rating = BitConverter.ToInt16(propItem.Value, 0).ToString();
    

    It works fine for me.