ExifParser Class |
Namespace: Atalasoft.Imaging.Metadata
The ExifParser type exposes the following members.
Name | Description | |
---|---|---|
ExifParser | Initializes a new instance of ExifParser. |
Name | Description | |
---|---|---|
FormatTags | Obsolete. Deprecated | |
ThumbnailCallback | Obsolete. Deprecated |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnError |
Raises the [E:Error] event.
| |
ParseFromByteArray | Parses a byte array of EXIF data. | |
ParseFromImage(Stream) | Parses EXIF data from a JPEG or TIFF image file stream. | |
ParseFromImage(String) | Parses EXIF data from a JPEG or TIFF image file. | |
ParseFromImage(Stream, Int32) | Parses EXIF data from an image file stream, specifying the frame index of a multipage TIFF. | |
ParseFromImage(String, Int32) | Parses EXIF data from an image file, specifying the frame index of a multipage TIFF. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
CodecError | This event is used by the ExifParser object to report errors that occur when parsing an
image. |
EXIF (Exchangeable Image File Format) is a standard for storing interchange information in image files, in particular JPEG images. This metadata is commonly used in digital camera images to store information specific to digital photography such as shutter speed, date taken, aperture, GPS information, and other information depending on the make of the camera.
This example demonstrates how to retreive EXIF tags from a JPEG image.
ExifTextParser exifParser = new ExifTextParser(); ExifTextCollection exifTags = exifParser.Parse("myimage.jpg");
Dim exifParser As ExifTextParser = New ExifTextParser() Dim exifTags As ExifTextCollection = exifParser.Parse("myimage.jpg")
This example shows how to retrieve EXIF data from an image, then save it back to a new image.
//get EXIF Tags ExifParser exifParse = new ExifParser(); ExifCollection exifTags = exifParse.ParseFromImage(@"c\in.jpg"); //get JPEG Markers JpegMarkerCollection appMarkersIn = new JpegMarkerCollection(@"c\in.jpg"); //read image Workspace myWorkspace = new Workspace(); myWorkspace.Open(@"c\in.jpg"); //get the DataTime Tag from the image and display the value if (exifTags != null) { ExifTag tag = exifTags.LookupTag("DateTime"); if (tag != null) MessageBox.Show("This photo was taken on " + tag.Data.ToString()); } JpegEncoder jpeg = new JpegEncoder(75); //only write EXIF Tags back to the image (APP1) JpegMarkerCollection appMarkersOut = new JpegMarkerCollection(); foreach (JpegMarker mk in appMarkersIn) if (mk.Type == JpegMarkerTypes.MarkerApp1) appMarkersOut.Add(mk); jpeg.AppMarkers = appMarkersOut; myWorkspace.Save("c:\\out.jpg", jpeg);
'get EXIF Tags Dim exifParse As ExifParser = New ExifParser() Dim exifTags As ExifCollection = exifParse.ParseFromImage("c\in.jpg") 'get JPEG Markers Dim appMarkersIn As JpegMarkerCollection = New JpegMarkerCollection("c:\in.jpg") 'read image Dim myWorkspace As Workspace = New Workspace() myWorkspace.Open("c:\in.jpg") 'get the DataTime Tag from the image and display the value If Not exifTags Is Nothing Then Dim tag As ExifTag = exifTags.LookupTag("DateTime") If Not tag Is Nothing Then MessageBox.Show("This photo was taken on " & tag.Data.ToString()) End If End If Dim jpeg As JpegEncoder = New JpegEncoder(75) 'only write EXIF Tags back to the image (APP1) Dim appMarkersOut As JpegMarkerCollection = New JpegMarkerCollection() Dim mk As JpegMarker For Each mk In appMarkersIn If mk.Type = JpegMarkerTypes.MarkerApp1 Then appMarkersOut.Add(mk) End If Next jpeg.AppMarkers = appMarkersOut myWorkspace.Save("c:\out.jpg", jpeg)