This project has moved. For the latest updates, please go here.

EXIF Information with description?

Aug 13, 2016 at 10:36 PM
Hello,

some EXIF info I choice using ImageMagick, showing only an ID instead of a description. Is there a way to display the description.

Here are some examples of ImageMagick and EXIF Libary:

ImageMagick:
  • Orientation: 1
  • ResolutionUnit: 2
  • YCbCrPositioning: 2
  • ExposureProgram: 2
  • ExposureTime: 0.0666666666666667
  • Flash: 24
  • ColorSpace: 1
  • MeteringMode: 5
EXIF-Libary:
  • Orientation: Normal
  • ResolutionUnit: Inches
  • YCbCrPositioning: CoSited
  • ExposureProgram: Normal
  • ExposureTime: 1/15
  • Flash: CompulsoryFlashMode, AutoMode
  • ColorSpace: sRGB
  • MeteringMode: Pattern
regards,
Oliver
Coordinator
Aug 13, 2016 at 10:59 PM
Edited Aug 13, 2016 at 11:00 PM
Getting a description is currently not available in Magick.NET. Creating this is not impossible but will take a lot of work. There is a great list with descriptions here: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html and I could create a class that would use a description when you do ExifValue.ToString(). It would work something like this:
internal static class ExifDescriptions
{
  public static string GetDescription(ExifTag tag, object value)
  {
    switch (tag)
    {
      case ExifTag.ResolutionUnit:
        return GetResolutionUnitDescription((ushort) value);
      default:
        return null;
    }
  }

  private static string GetResolutionUnitDescription(ushort value)
  {
    switch(value)
    {
      default:
        return "None";
      case 2:
        return "Inches";
      case 3:
        return "Cm";
    }
  }
}
As you can see it is not impossible but would take quite some time to complete. If you are willing to help me create this class we can add it to Magick.NET much quicker.
Coordinator
Aug 14, 2016 at 12:49 PM
Edited Aug 14, 2016 at 12:50 PM
I have decided to use a different approach. The ExifTag enum can now have descriptions. I added this for one value:
[ExifTagDescription((ushort)1, "None")]
[ExifTagDescription((ushort)2, "Inches")]
[ExifTagDescription((ushort)3, "Cm")]
ResolutionUnit = 0x0128,
I can still use some help to add this for the other values.
Aug 14, 2016 at 3:15 PM
ok, thanks - I can do anything to you to help?
Coordinator
Aug 14, 2016 at 6:29 PM
The ExifTagDescription will need to be added to a lot more exif tags. You could make the changes to ExifTag.cs and send me a pull request if you are familiar with GIT
Aug 14, 2016 at 10:22 PM
can you send me an example, pls?
Coordinator
Aug 14, 2016 at 11:14 PM
Aug 15, 2016 at 9:41 PM
Question:

Bit 0 = Unspecified compression
Bit 1 = Modified Huffman
Bit 2 = Modified Read
Bit 3 = Modified MR

is this ok?
    [ExifTagDescription((ushort)0, "Unspecified compression")]
    [ExifTagDescription((ushort)1, "Modified Huffman")]
    [ExifTagDescription((ushort)2, "Modified Read")]
    [ExifTagDescription((ushort)3, "Modified MR")]
Aug 15, 2016 at 9:50 PM
and

0x1 = sRGB
0x2 = Adobe RGB
0xfffd = Wide Gamut RGB
0xfffe = ICC Profile
0xffff = Uncalibrated

ok?
    [ExifTagDescription((string)"0x1", "sRGB")]
    [ExifTagDescription((string)"0x2", "Adobe RGB")]
    [ExifTagDescription((string)"0xfffd", "Wide Gamut RGB")]
    [ExifTagDescription((string)"0xfffe", "ICC Profile")]
    [ExifTagDescription((string)"0xffff", "Uncalibrated")]
Coordinator
Aug 15, 2016 at 9:50 PM
That won't work the type (ushort) must be the correct type for this exif tag and for CodingMethods you should use long (N). Bit 0,1,2 are correct but bit 3 means the value 4 and bit 6 means value 32.
Aug 15, 2016 at 10:26 PM
hmmm ... i have now change your ExifTag.cs ... pls check my changes.
Where I was not sure I've CHECK written before.
In the link you gave me, some days are also there. Is this ok?

Here this file:
ExifTag.cs
Coordinator
Aug 16, 2016 at 6:07 AM
WOW! Thanks for the help Oliver, will check them tonight when I get home from work. Will you do a pull request or do you want me to apply the changes myself?
Aug 16, 2016 at 9:11 AM
i am not sure.... i want you to do this. many thanks.
Coordinator
Aug 16, 2016 at 10:38 PM
Your patch has been added thanks for the help :)
Aug 17, 2016 at 8:33 AM
I have to thank.