ExifTagCollection - An EXIF metadata extraction library






4.87/5 (42 votes)
A library to extract EXIF information from images, compliant with the EXIF 2.2 standard.
Introduction
This library is inspired by the ExifExtractor
class by Asim Goheer. The problem with ExifExtractor
was that it does not support some tags defined in the EXIF 2.2 standard, like tags related to GPS data, so I decided to modify it, but, eventually, decided to write it from scratch, though I reused some of Asim's code..
The ExifTagsCollection
is based on IEnumerable<T>
, and holds a collection of ExifTag
classes that encapsulates an EXIF tag.
The ExifTag
class holds the field name, description, ID, and the value for the given tag. A couple of convenient classes have been added:
Rational
- for signed rational valuesURational
- for unsigned rational valuesGPSRational
- for GPS 24 bit data
Using the code
Using the code is pretty straightforward. Here is an example of listing all the tags in the console:
// See other constructors, for creating ExifTagCollection with Image instance, etc.
ExifTagCollection exif = new ExifTagCollection(@"c:\somefile.jpg");
foreach (ExifTag tag in exif)
Console.Out.WriteLine(tag);
Another example for getting a specific tag by ID:
ExifTagCollection exif = new ExifTagCollection(@"c:\somefile.jpg");
ExifTag tag = exif[2];
Console.Out.WriteLine(tag);
//OUTPUT: Latitude (GPSLatitude) = 22° 47' 35,35"
Supported EXIF fields:
ImageWidth
- Image widthImageHeight
- Image heightGPSVersionID
- GPS tag versionGPSAltitudeRef
- Altitude referenceStripOffsets
- Image data locationRowsPerStrip
- Number of rows per stripStripByteCounts
- Bytes per compressed stripPixelXDimension
- Valid image widthPixelYDimension
- Valid image heightBitsPerSample
- Number of bits per componentCompression
- Compression schemePhotometricInterpretation
- Pixel compositionOrientation
- Orientation of imageSamplesPerPixel
- Number of componentsPlanarConfiguration
- Image data arrangementYCbCrSubSampling
- Sub-sampling ratio of Y to CYCbCrPositioning
- Y and C positioningResolutionUnit
- Unit of X and Y resolutionTransferFunction
- Transfer functionColorSpace
- Color space informationExposureProgram
- Exposure programISOSpeedRatings
- ISO speed ratingMeteringMode
- Metering modeLightSource
- Light sourceFlash
- FlashSubjectArea
- Subject areaFocalPlaneResolutionUnit
- Focal plane resolution unitSubjectLocation
- Subject locationSensingMethod
- Sensing methodCustomRendered
- Custom image processingExposureMode
- Exposure modeWhiteBalance
- White balanceFocalLengthIn35mmFilm
- Focal length in 35 mm filmSceneCaptureType
- Scene capture typeContrast
- ContrastSaturation
- SaturationSharpness
- SharpnessSubjectDistanceRange
- Subject distance rangeGPSDifferential
- GPS differential correctionShutterSpeedValue
- Shutter speedBrightnessValue
- BrightnessExposureBiasValue
- Exposure biasJPEGInterchangeFormat
- Offset to JPEG SOIJPEGInterchangeFormatLength
- Bytes of JPEG dataXResolution
- Image resolution in width directionYResolution
- Image resolution in height directionWhitePoint
- White point chromaticityPrimaryChromaticities
- Chromaticities of primariesYCbCrCoefficients
- Color space transformation matrix coefficientsReferenceBlackWhite
- Pair of black and white reference valuesCompressedBitsPerPixel
- Image compression modeExposureTime
- Exposure timeFNumber
- F numberApertureValue
- ApertureMaxApertureValue
- Maximum lens apertureSubjectDistance
- Subject distanceFocalLength
- Lens focal lengthFlashEnergy
- Flash energyFocalPlaneXResolution
- Focal plane X resolutionFocalPlaneYResolution
- Focal plane Y resolutionExposureIndex
- Exposure indexDigitalZoomRatio
- Digital zoom ratioGainControl
- Gain controlGPSLatitude
- LatitudeGPSLongitude
- LongitudeGPSAltitude
- AltitudeGPSTimeStamp
- GPS time (atomic clock)GPSDOP
- Measurement precisionGPSSpeed
- Speed of GPS receiverGPSTrack
- Direction of movementGPSImgDirection
- Direction of imageGPSDestLatitude
- Latitude of destinationGPSDestLongitude
- Longitude of destinationGPSDestBearing
- Bearing of destinationGPSDestDistance
- Distance to destinationDateTime
- File change date and timeImageDescription
- Image titleMake
- Image input equipment manufacturerModel
- Image input equipment modelSoftware
- Software usedArtist
- Person who created the imageCopyright
- Copyright holderRelatedSoundFile
- Related audio fileDateTimeOriginal
- Date and time of original data generationDateTimeDigitized
- Date and time of digital data generationSubSecTime
-DateTime
subsecondsSubSecTimeOriginal
-DateTimeOriginal
subsecondsSubSecTimeDigitized
-DateTimeDigitized
subsecondsImageUniqueID
- Unique image IDSpectralSensitivity
- Spectral sensitivityGPSLatitudeRef
- North or South LatitudeGPSLongitudeRef
- East or West LongitudeGPSSatellites
- GPS satellites used for measurementGPSStatus
- GPS receiver statusGPSMeasureMode
- GPS measurement modeGPSSpeedRef
- Speed unitGPSTrackRef
- Reference for direction of movementGPSImgDirectionRef
- Reference for direction of imageGPSMapDatum
- Geodetic survey data usedGPSDestLatitudeRef
- Reference for latitude of destinationGPSDestLongitudeRef
- Reference for longitude of destinationGPSDestBearingRef
- Reference for bearing of destinationGPSDestDistanceRef
- Reference for distance to destinationGPSDateStamp
- GPS dateOECF
- Optoelectric conversion factorSpatialFrequencyResponse
- Spatial frequency responseFileSource
- File sourceSceneType
- Scene typeCFAPattern
- CFA patternDeviceSettingDescription
- Device settings descriptionExifVersion
- EXIF versionFlashpixVersion
- Supported Flashpix versionComponentsConfiguration
- Meaning of each componentMakerNote
- Manufacturer notesUserComment
- User commentsGPSProcessingMethod
- Name of GPS processing methodGPSAreaInformation
- Name of GPS area
History
- Initial release.