VintaSoft Imaging .NET SDK v8.7
In This Topic
    Image metadata
    In This Topic

    Image metadata carry a data about image and define such aspects as keywords, GPS location, camera information and more.


    The SDK provides the ability to get metadata from image file, edit existing and add new metadata. All these operations are performed without loading of image from file.

    The SDK allows working with following types of metadata:


    There are 3 techniques of accessing image metadata:


    Access to metadata of VintasoftImage class instance

    VintasoftImageMetadata class provides simplified access to image metadata in case when work with image is performed using VintasoftImage class. Access to an instance of VintasoftImageMetadata class may be obtained using VintasoftImage.Metadata property.

    VintasoftImageMetadata class provides access to:

    Here is an example showing how to obtain information about annotation packets which are stored in JPEG file metadata:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintInfoAboutJpegFileAnnotations(filename As String)
            ' create an instance of VintasoftImage class
            Using jpegImage As New Vintasoft.Imaging.VintasoftImage(filename)
                    ' get reference to a metadata tree of JPEG page
                    Dim jpegPageMetadata As Vintasoft.Imaging.Metadata.MetadataNode = jpegImage.Metadata.MetadataTree
    
                    ' create an instance of MetadataTreeHelper class
                    Dim metadataTreeHelper As New Vintasoft.Imaging.Metadata.MetadataTreeHelper(jpegPageMetadata)
    
                    '
                    If Not metadataTreeHelper.HasVintasoftBinaryAnnotations AndAlso Not metadataTreeHelper.HasVintasoftXmpAnnotations Then
                            System.Console.Write(String.Format("File '{0}' does not have annotations.", filename))
                    Else
                            If metadataTreeHelper.HasVintasoftBinaryAnnotations Then
                                    System.Console.Write(String.Format("File '{0}' has VintasoftBinary annotations.", filename))
                            End If
    
                            If metadataTreeHelper.HasVintasoftXmpAnnotations Then
                                    System.Console.Write(String.Format("File '{0}' has VintasoftXmp annotations.", filename))
                            End If
                    End If
            End Using
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintInfoAboutJpegFileAnnotations(string filename)
    {
        // create an instance of VintasoftImage class
        using (Vintasoft.Imaging.VintasoftImage jpegImage = new Vintasoft.Imaging.VintasoftImage(filename))
        {
            // get reference to a metadata tree of JPEG page
            Vintasoft.Imaging.Metadata.MetadataNode jpegPageMetadata = jpegImage.Metadata.MetadataTree;
    
            // create an instance of MetadataTreeHelper class
            Vintasoft.Imaging.Metadata.MetadataTreeHelper metadataTreeHelper = 
                new Vintasoft.Imaging.Metadata.MetadataTreeHelper(jpegPageMetadata);
    
            //
            if (!metadataTreeHelper.HasVintasoftBinaryAnnotations &&
                !metadataTreeHelper.HasVintasoftXmpAnnotations)
                System.Console.Write(string.Format("File '{0}' does not have annotations.", filename));
            else
            {
                if (metadataTreeHelper.HasVintasoftBinaryAnnotations)
                    System.Console.Write(string.Format("File '{0}' has VintasoftBinary annotations.", filename));
    
                if (metadataTreeHelper.HasVintasoftXmpAnnotations)
                    System.Console.Write(string.Format("File '{0}' has VintasoftXmp annotations.", filename));
            }
        }
    }
                    
    


    Tree of metadata represents image metadata, presented like tree-type structure. Access to the tree of metadata can be obtained using VintasoftImageMetadata.MetadataTree property.
    Root of tree is a node that represents a page of image file. Each tree node may contain information about image metadata and child nodes.


    Here is an example showing how to obtain information about TIFF tags of TIFF file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintInfoAboutTiffFile(filename As String)
            ' create an image collection
            Dim images As New Vintasoft.Imaging.ImageCollection()
            ' add TIFF file to a collection
            images.Add(filename)
    
            For i As Integer = 0 To images.Count - 1
                    System.Console.WriteLine(String.Format("Page {0}", i))
    
                    ' get reference to a metadata tree of TIFF page
                    Dim tiffPageMetadata As Vintasoft.Imaging.Metadata.MetadataNode = images(i).Metadata.MetadataTree
    
                    ' search for tree node that contains information about TIFF IFD
                    Dim tiffIfdMetadata As Vintasoft.Imaging.Metadata.TiffIfdMetadata = tiffPageMetadata.FindChildNode(Of Vintasoft.Imaging.Metadata.TiffIfdMetadata)()
                    ' if tree node that contains information about TIFF IFD is found
                    If tiffIfdMetadata IsNot Nothing Then
                            ' if TIFF IFD is found
                            If tiffIfdMetadata.ImageFileDirectory IsNot Nothing Then
                                    ' print info about TIFF IFD data
                                    PrintInfoAboutTiffIfdData(tiffIfdMetadata.ImageFileDirectory)
                            End If
                    End If
            Next
    End Sub
    
    Private Sub PrintInfoAboutTiffIfdData(ifd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
            System.Console.WriteLine("  TIFF IFD data:")
    
            ' print info about tag collection of EXIF data
            PrintTiffTagCollectionInfo(ifd.Tags, "    ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintTiffTagCollectionInfo(tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection, indent As String)
            ' print tag count
            System.Console.WriteLine(String.Format("{0}Tags [{1}]:", indent, tags.Count))
            ' for each tag
            For i As Integer = 0 To tags.Count - 1
                    ' print tag info
                    System.Console.WriteLine(String.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags(i).Id, tags(i).Name, tags(i).Data))
    
                    ' if tag data is TiffImageFileDirectory
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory) Then
                            Dim subIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
                            ' print info about tag collection of sub IFD
                            PrintTiffTagCollectionInfo(subIfd.Tags, indent & "  ")
                    End If
                    ' if tag data is TiffImageFileDirectory[]
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory()) Then
                            Dim subIfds As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory() = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory())
                            For j As Integer = 0 To subIfds.Length - 1
                                    ' print info about tag collection of sub IFD
                                    PrintTiffTagCollectionInfo(subIfds(j).Tags, indent & "  ")
                            Next
                    End If
            Next
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintInfoAboutTiffFile(string filename)
    {
        // create an image collection
        Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection();
        // add TIFF file to a collection
        images.Add(filename);
    
        for (int i = 0; i < images.Count; i++)
        {
            System.Console.WriteLine(string.Format("Page {0}", i));
    
            // get reference to a metadata tree of TIFF page
            Vintasoft.Imaging.Metadata.MetadataNode tiffPageMetadata = images[i].Metadata.MetadataTree;
    
            // search for tree node that contains information about TIFF IFD
            Vintasoft.Imaging.Metadata.TiffIfdMetadata tiffIfdMetadata = 
                tiffPageMetadata.FindChildNode<Vintasoft.Imaging.Metadata.TiffIfdMetadata>();
            // if tree node that contains information about TIFF IFD is found
            if (tiffIfdMetadata != null)
            {
                // if TIFF IFD is found
                if (tiffIfdMetadata.ImageFileDirectory != null)
                    // print info about TIFF IFD data
                    PrintInfoAboutTiffIfdData(tiffIfdMetadata.ImageFileDirectory);
            }
        }
    }
    
    private void PrintInfoAboutTiffIfdData(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory ifd)
    {
        System.Console.WriteLine("  TIFF IFD data:");
    
        // print info about tag collection of EXIF data
        PrintTiffTagCollectionInfo(ifd.Tags, "    ");
    
        System.Console.WriteLine();
    }
    
    private void PrintTiffTagCollectionInfo(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags, string indent)
    {
        // print tag count
        System.Console.WriteLine(string.Format("{0}Tags [{1}]:", indent, tags.Count));
        // for each tag
        for (int i = 0; i < tags.Count; i++)
        {
            // print tag info
            System.Console.WriteLine(string.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags[i].Id, tags[i].Name, tags[i].Data));
    
            // if tag data is TiffImageFileDirectory
            if (tags[i].Data.GetType() == typeof(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory subIfd = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)tags[i].Data;
                // print info about tag collection of sub IFD
                PrintTiffTagCollectionInfo(subIfd.Tags, indent + "  ");
            }
            // if tag data is TiffImageFileDirectory[]
            if (tags[i].Data.GetType() == typeof(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[]))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[] subIfds = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[])tags[i].Data;
                for (int j = 0; j < subIfds.Length; j++)
                    // print info about tag collection of sub IFD
                    PrintTiffTagCollectionInfo(subIfds[j].Tags, indent + "  ");
            }
        }
    }
                    
    


    Here is an example showing how to obtain EXIF information about JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintExifInfoAboutJpegFile(filename As String)
            ' create an instance of VintasoftImage class
            Using jpegImage As New Vintasoft.Imaging.VintasoftImage(filename)
                    ' get reference to a metadata tree of JPEG page
                    Dim jpegPageMetadata As Vintasoft.Imaging.Metadata.MetadataNode = jpegImage.Metadata.MetadataTree
                    ' search for tree node that contains information about JPEG thumbnail
                    Dim jpegApp1ExifSegmentMetadata As Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata = jpegPageMetadata.FindChildNode(Of Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata)()
                    ' if tree node that contains EXIF information is found
                    If jpegApp1ExifSegmentMetadata IsNot Nothing Then
                            ' if EXIF data is found
                            If jpegApp1ExifSegmentMetadata.IFD0 IsNot Nothing Then
                                    ' print info about EXIF data
                                    PrintInfoAboutExifData(jpegApp1ExifSegmentMetadata.IFD0)
                            End If
    
                            ' if EXIF thumbnail data is found
                            If jpegApp1ExifSegmentMetadata.IFD1 IsNot Nothing Then
                                    ' print info about EXIF thumbnail data
                                    PrintInfoAboutExifThumbnailData(jpegApp1ExifSegmentMetadata.IFD1)
                            End If
    
                            ' if EXIF thumbnail is found
                            If jpegApp1ExifSegmentMetadata.Thumbnail IsNot Nothing Then
                                    ' print info about EXIF thumbnail
                                    PrintInfoAboutExifThumbnail(jpegApp1ExifSegmentMetadata.Thumbnail)
                            End If
                    End If
            End Using
    End Sub
    
    Private Sub PrintInfoAboutExifData(jpegApp1Ifd0Metadata As Vintasoft.Imaging.Metadata.JpegApp1Ifd0Metadata)
            System.Console.WriteLine("EXIF data:")
    
            ' print info about tag collection of EXIF data
            PrintExifTagCollectionInfo(jpegApp1Ifd0Metadata.ImageFileDirectory.Tags, "  ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintInfoAboutExifThumbnailData(jpegApp1Ifd1Metadata As Vintasoft.Imaging.Metadata.JpegApp1Ifd1Metadata)
            System.Console.WriteLine("EXIF thumbnail data:")
    
            ' print info about tag collection of EXIF thumbnail data
            PrintExifTagCollectionInfo(jpegApp1Ifd1Metadata.ImageFileDirectory.Tags, "  ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintInfoAboutExifThumbnail(thumbnailMetadata As Vintasoft.Imaging.Metadata.ThumbnailMetadata)
            System.Console.WriteLine("EXIF thumbnail:")
    
            ' print info about EXIF thumbnail
            System.Console.WriteLine(String.Format("  Thumbnail size: {0}", thumbnailMetadata.ThumbnailSize))
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintExifTagCollectionInfo(tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection, indent As String)
            ' print tag count
            System.Console.WriteLine(String.Format("{0}Tags [{1}]:", indent, tags.Count))
            ' for each tag
            For i As Integer = 0 To tags.Count - 1
                    ' print tag info
                    System.Console.WriteLine(String.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags(i).Id, tags(i).Name, tags(i).Data))
    
                    ' if tag data is TiffImageFileDirectory
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory) Then
                            Dim subIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
                            ' print info about tag collection of sub IFD
                            PrintExifTagCollectionInfo(subIfd.Tags, indent & "  ")
                    End If
                    ' if tag data is TiffImageFileDirectory[]
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory()) Then
                            Dim subIfds As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory() = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory())
                            For j As Integer = 0 To subIfds.Length - 1
                                    ' print info about tag collection of sub IFD
                                    PrintExifTagCollectionInfo(subIfds(j).Tags, indent & "  ")
                            Next
                    End If
            Next
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintExifInfoAboutJpegFile(string filename)
    {
        // create an instance of VintasoftImage class
        using (Vintasoft.Imaging.VintasoftImage jpegImage = new Vintasoft.Imaging.VintasoftImage(filename))
        {
            // get reference to a metadata tree of JPEG page
            Vintasoft.Imaging.Metadata.MetadataNode jpegPageMetadata = jpegImage.Metadata.MetadataTree;
            // search for tree node that contains information about JPEG thumbnail
            Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata jpegApp1ExifSegmentMetadata = 
                jpegPageMetadata.FindChildNode<Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata>();
            // if tree node that contains EXIF information is found
            if (jpegApp1ExifSegmentMetadata != null)
            {
                // if EXIF data is found
                if (jpegApp1ExifSegmentMetadata.IFD0 != null)
                    // print info about EXIF data
                    PrintInfoAboutExifData(jpegApp1ExifSegmentMetadata.IFD0);
    
                // if EXIF thumbnail data is found
                if (jpegApp1ExifSegmentMetadata.IFD1 != null)
                    // print info about EXIF thumbnail data
                    PrintInfoAboutExifThumbnailData(jpegApp1ExifSegmentMetadata.IFD1);
    
                // if EXIF thumbnail is found
                if (jpegApp1ExifSegmentMetadata.Thumbnail != null)
                    // print info about EXIF thumbnail
                    PrintInfoAboutExifThumbnail(jpegApp1ExifSegmentMetadata.Thumbnail);
            }
        }
    }
    
    private void PrintInfoAboutExifData(Vintasoft.Imaging.Metadata.JpegApp1Ifd0Metadata jpegApp1Ifd0Metadata)
    {
        System.Console.WriteLine("EXIF data:");
    
        // print info about tag collection of EXIF data
        PrintExifTagCollectionInfo(jpegApp1Ifd0Metadata.ImageFileDirectory.Tags, "  ");
    
        System.Console.WriteLine();
    }
    
    private void PrintInfoAboutExifThumbnailData(Vintasoft.Imaging.Metadata.JpegApp1Ifd1Metadata jpegApp1Ifd1Metadata)
    {
        System.Console.WriteLine("EXIF thumbnail data:");
    
        // print info about tag collection of EXIF thumbnail data
        PrintExifTagCollectionInfo(jpegApp1Ifd1Metadata.ImageFileDirectory.Tags, "  ");
    
        System.Console.WriteLine();
    }
    
    private void PrintInfoAboutExifThumbnail(Vintasoft.Imaging.Metadata.ThumbnailMetadata thumbnailMetadata)
    {
        System.Console.WriteLine("EXIF thumbnail:");
    
        // print info about EXIF thumbnail
        System.Console.WriteLine(string.Format("  Thumbnail size: {0}", thumbnailMetadata.ThumbnailSize));
    
        System.Console.WriteLine();
    }
    
    private void PrintExifTagCollectionInfo(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags, string indent)
    {
        // print tag count
        System.Console.WriteLine(string.Format("{0}Tags [{1}]:", indent, tags.Count));
        // for each tag
        for (int i = 0; i < tags.Count; i++)
        {
            // print tag info
            System.Console.WriteLine(string.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags[i].Id, tags[i].Name, tags[i].Data));
            
            // if tag data is TiffImageFileDirectory
            if (tags[i].Data.GetType() == typeof(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory subIfd = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)tags[i].Data;
                // print info about tag collection of sub IFD
                PrintExifTagCollectionInfo(subIfd.Tags, indent + "  ");
            }
            // if tag data is TiffImageFileDirectory[]
            if (tags[i].Data.GetType() == typeof(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[]))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[] subIfds = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[])tags[i].Data;
                for (int j = 0; j < subIfds.Length; j++)
                    // print info about tag collection of sub IFD
                    PrintExifTagCollectionInfo(subIfds[j].Tags, indent + "  ");
            }
        }
    }
                    
    


    Here is an example showing how to change GPS information about JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub ChangeGpsInfoAboutJpegFile(filename As String)
            ' open a file stream in read-write mode
            Using fs As New System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)
                    ' create an instance of VintasoftImage class
                    Using jpegImage As New Vintasoft.Imaging.VintasoftImage(fs)
                            ' get reference to a metadata tree of JPEG page
                            Dim jpegPageMetadata As Vintasoft.Imaging.Metadata.MetadataNode = jpegImage.Metadata.MetadataTree
                            ' search for tree node that contains information about JPEG thumbnail
                            Dim jpegApp1ExifSegmentMetadata As Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata = jpegPageMetadata.FindChildNode(Of Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata)()
                            ' if tree node that contains information about JPEG thumbnail is found
                            If jpegApp1ExifSegmentMetadata IsNot Nothing Then
                                    ' if EXIF data is found
                                    If jpegApp1ExifSegmentMetadata.IFD0 IsNot Nothing Then
                                            ' if GPS info is not found
                                            If jpegApp1ExifSegmentMetadata.IFD0.GpsIFD Is Nothing Then
                                                    ' create node that contains GPS info
                                                    jpegApp1ExifSegmentMetadata.IFD0.CreateGpsIFD()
                                            End If
    
                                            ' get reference to a GPS IFD
                                            Dim gpsIfd As Vintasoft.Imaging.Metadata.TiffIfdMetadata = jpegApp1ExifSegmentMetadata.IFD0.GpsIFD
    
                                            ' search for tag that contains info about GPS date stamp
                                            Dim gpsDateStampTag As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag = gpsIfd.ImageFileDirectory.Tags.Find(CUShort(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp))
                                            ' if tag that contains info about GPS date stamp is found
                                            If gpsDateStampTag IsNot Nothing Then
                                                    ' change the tag data
                                                    gpsDateStampTag.Data = System.DateTime.Now.ToString()
                                            Else
                                                    ' if tag that contains info about GPS date stamp is not found
                                                    ' add the GPS date stamp
                                                    gpsIfd.ImageFileDirectory.Tags.Add(CUShort(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp), System.DateTime.Now.ToString())
                                            End If
    
                                            ' create an encoder for image saving
                                            Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.JpegEncoder()
                                            encoder.SaveAndSwitchSource = True
                                            ' save changes to the source stream
                                            jpegImage.Save(fs, encoder)
                                    End If
                            End If
                    End Using
            End Using
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void ChangeGpsInfoAboutJpegFile(string filename)
    {
        // open a file stream in read-write mode
        using (System.IO.FileStream fs = new System.IO.FileStream(
            filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite))
        {
            // create an instance of VintasoftImage class
            using (Vintasoft.Imaging.VintasoftImage jpegImage = new Vintasoft.Imaging.VintasoftImage(fs))
            {
                // get reference to a metadata tree of JPEG page
                Vintasoft.Imaging.Metadata.MetadataNode jpegPageMetadata = jpegImage.Metadata.MetadataTree;
                // search for tree node that contains information about JPEG thumbnail
                Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata jpegApp1ExifSegmentMetadata = 
                    jpegPageMetadata.FindChildNode<Vintasoft.Imaging.Metadata.JpegApp1ExifSegmentMetadata>();
                // if tree node that contains information about JPEG thumbnail is found
                if (jpegApp1ExifSegmentMetadata != null)
                {
                    // if EXIF data is found
                    if (jpegApp1ExifSegmentMetadata.IFD0 != null)
                    {
                        // if GPS info is not found
                        if (jpegApp1ExifSegmentMetadata.IFD0.GpsIFD == null)
                            // create node that contains GPS info
                            jpegApp1ExifSegmentMetadata.IFD0.CreateGpsIFD();
    
                        // get reference to a GPS IFD
                        Vintasoft.Imaging.Metadata.TiffIfdMetadata gpsIfd = jpegApp1ExifSegmentMetadata.IFD0.GpsIFD;
    
                        // search for tag that contains info about GPS date stamp
                        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag gpsDateStampTag = 
                            gpsIfd.ImageFileDirectory.Tags.Find((ushort)Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp);
                        // if tag that contains info about GPS date stamp is found
                        if (gpsDateStampTag != null)
                            // change the tag data
                            gpsDateStampTag.Data = System.DateTime.Now.ToString();
                        // if tag that contains info about GPS date stamp is not found
                        else
                            // add the GPS date stamp
                            gpsIfd.ImageFileDirectory.Tags.Add(
                                (ushort)Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp, 
                                System.DateTime.Now.ToString());
    
                        // create an encoder for image saving
                        Vintasoft.Imaging.Codecs.Encoders.JpegEncoder encoder = new Vintasoft.Imaging.Codecs.Encoders.JpegEncoder();
                        encoder.SaveAndSwitchSource = true;
                        // save changes to the source stream
                        jpegImage.Save(fs, encoder);
                    }
                }
            }
        }
    }
                    
    


    Here is an example showing how to get thumbnail of JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Function GetJpegThumbnail(filename As String) As Vintasoft.Imaging.VintasoftImage
            ' create an instance of VintasoftImage class
            Using jpegImage As New Vintasoft.Imaging.VintasoftImage(filename)
                    ' get reference to a metadata tree of JPEG page
                    Dim jpegPageMetadata As Vintasoft.Imaging.Metadata.MetadataNode = jpegImage.Metadata.MetadataTree
                    ' search for tree node that contains information about JPEG thumbnail
                    Dim jpegThumbnailMetadata As Vintasoft.Imaging.Metadata.JpegApp1ThumbnailMetadata = jpegPageMetadata.FindChildNode(Of Vintasoft.Imaging.Metadata.JpegApp1ThumbnailMetadata)()
                    ' if tree node that contains information about JPEG thumbnail is found
                    If jpegThumbnailMetadata IsNot Nothing Then
                            ' return thumbnail of JPEG page
                            Return jpegThumbnailMetadata.ThumbnailImage
                    End If
    
                    ' JPEG page does not have thumbnail
                    Return Nothing
            End Using
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public Vintasoft.Imaging.VintasoftImage GetJpegThumbnail(string filename)
    {
        // create an instance of VintasoftImage class
        using (Vintasoft.Imaging.VintasoftImage jpegImage = 
            new Vintasoft.Imaging.VintasoftImage(filename))
        {
            // get reference to a metadata tree of JPEG page
            Vintasoft.Imaging.Metadata.MetadataNode jpegPageMetadata = jpegImage.Metadata.MetadataTree;
            // search for tree node that contains information about JPEG thumbnail
            Vintasoft.Imaging.Metadata.JpegApp1ThumbnailMetadata jpegThumbnailMetadata = 
                jpegPageMetadata.FindChildNode<Vintasoft.Imaging.Metadata.JpegApp1ThumbnailMetadata>();
            // if tree node that contains information about JPEG thumbnail is found
            if (jpegThumbnailMetadata != null)
                // return thumbnail of JPEG page
                return jpegThumbnailMetadata.ThumbnailImage;
    
            // JPEG page does not have thumbnail
            return null;
        }
    }
                    
    



    Access to metadata of class instance which is derived from ImageFile class

    ImageFileBase class is an abstract class providing access to image file. For each of supported image file format exist a class derived from ImageFileBase class, notably:

    Metadata of image file can be obtained using properties and methods of instance of class which is derived from ImageFileBase class. Also the instance of class derived from ImageFileBase class provides access to file pages.

    Here is an example showing how to obtain format and version of TIFF file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintInfoAboutTiffFileFormatAndVersion(filename As String)
            ' create an instance of TiffFile class
            Using tiffFile As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(filename)
                    System.Console.WriteLine(String.Format("TIFF Format={0} Version={1}", tiffFile.Format, tiffFile.Version))
            End Using
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintInfoAboutTiffFileFormatAndVersion(string filename)
    {
        // create an instance of TiffFile class
        using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(filename))
        {
            System.Console.WriteLine(string.Format("TIFF Format={0} Version={1}", tiffFile.Format, tiffFile.Version));
        }
    }
                    
    


    ImagePage class is an abstract class providing access to image page. For each of supported image file format exist a class derived from ImagePage class, notably:

    Metadata of image page can be obtained using properties and methods of instance of class which is derived from ImagePage class.


    Here is an example showing how to obtain information about TIFF tags of TIFF file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintInfoAboutTiffFile(filename As String)
            ' create an instance of TiffFile class
            Using tiffFile As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(filename)
                    ' for each TIFF page
                    For i As Integer = 0 To tiffFile.Pages.Count - 1
                            System.Console.WriteLine(String.Format("Page {0}", i))
    
                            ' print info about TIFF IFD data
                            PrintInfoAboutTiffIfdData(tiffFile.Pages(0).IFD)
                    Next
            End Using
    End Sub
    
    Private Sub PrintInfoAboutTiffIfdData(ifd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
            System.Console.WriteLine("  TIFF IFD data:")
    
            ' print info about tag collection of EXIF data
            PrintTiffTagCollectionInfo(ifd.Tags, "    ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintTiffTagCollectionInfo(tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection, indent As String)
            ' print tag count
            System.Console.WriteLine(String.Format("{0}Tags [{1}]:", indent, tags.Count))
            ' for each tag
            For i As Integer = 0 To tags.Count - 1
                    ' print tag info
                    System.Console.WriteLine(String.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags(i).Id, tags(i).Name, tags(i).Data))
    
                    ' if tag data is TiffImageFileDirectory
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory) Then
                            Dim subIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
                            ' print info about tag collection of sub IFD
                            PrintTiffTagCollectionInfo(subIfd.Tags, indent & "  ")
                    End If
                    ' if tag data is TiffImageFileDirectory[]
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory()) Then
                            Dim subIfds As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory() = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory())
                            For j As Integer = 0 To subIfds.Length - 1
                                    ' print info about tag collection of sub IFD
                                    PrintTiffTagCollectionInfo(subIfds(j).Tags, indent & "  ")
                            Next
                    End If
            Next
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintInfoAboutTiffFile(string filename)
    {
        // create an instance of TiffFile class
        using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(filename))
        {
            // for each TIFF page
            for (int i = 0; i < tiffFile.Pages.Count; i++)
            {
                System.Console.WriteLine(string.Format("Page {0}", i));
    
                // print info about TIFF IFD data
                PrintInfoAboutTiffIfdData(tiffFile.Pages[0].IFD);
            }
        }
    }
    
    private void PrintInfoAboutTiffIfdData(
        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory ifd)
    {
        System.Console.WriteLine("  TIFF IFD data:");
    
        // print info about tag collection of EXIF data
        PrintTiffTagCollectionInfo(ifd.Tags, "    ");
    
        System.Console.WriteLine();
    }
    
    private void PrintTiffTagCollectionInfo(
        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags, string indent)
    {
        // print tag count
        System.Console.WriteLine(string.Format("{0}Tags [{1}]:", indent, tags.Count));
        // for each tag
        for (int i = 0; i < tags.Count; i++)
        {
            // print tag info
            System.Console.WriteLine(string.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags[i].Id, tags[i].Name, tags[i].Data));
    
            // if tag data is TiffImageFileDirectory
            if (tags[i].Data.GetType() == typeof(
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory subIfd = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)tags[i].Data;
                // print info about tag collection of sub IFD
                PrintTiffTagCollectionInfo(subIfd.Tags, indent + "  ");
            }
            // if tag data is TiffImageFileDirectory[]
            if (tags[i].Data.GetType() == typeof(
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[]))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[] subIfds = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[])tags[i].Data;
                for (int j = 0; j < subIfds.Length; j++)
                    // print info about tag collection of sub IFD
                    PrintTiffTagCollectionInfo(subIfds[j].Tags, indent + "  ");
            }
        }
    }
                    
    


    Here is an example showing how to obtain EXIF information about JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub PrintExifInfoAboutJpegFile(filename As String)
            ' create an instance of JpegFile class
            Using jpegFile As New Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename)
                    ' if JPEG page contains EXIF information
                    If jpegFile.Page.Exif IsNot Nothing Then
                            Dim exifData As Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData = jpegFile.Page.Exif
    
                            ' if EXIF data is found
                            If exifData.ImageFileDirectory IsNot Nothing Then
                                    ' print info about EXIF data
                                    PrintInfoAboutExifData(exifData.ImageFileDirectory)
                            End If
    
                            ' if EXIF thumbnail data is found
                            If exifData.ThumbnailFileDirectory IsNot Nothing Then
                                    ' print info about EXIF thumbnail data
                                    PrintInfoAboutExifThumbnailData(exifData.ThumbnailFileDirectory)
                            End If
    
                            ' if EXIF thumbnail is found
                            If exifData.HasThumbnail Then
                                    ' print info about EXIF thumbnail
                                    PrintInfoAboutExifThumbnail(exifData)
                            End If
                    End If
            End Using
    End Sub
    
    Private Sub PrintInfoAboutExifData(exifDataIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
            System.Console.WriteLine("EXIF data:")
    
            ' print info about tag collection of EXIF data
            PrintExifTagCollectionInfo(exifDataIfd.Tags, "  ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintInfoAboutExifThumbnailData(exifThumbnailDataIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
            System.Console.WriteLine("EXIF thumbnail data:")
    
            ' print info about tag collection of EXIF thumbnail data
            PrintExifTagCollectionInfo(exifThumbnailDataIfd.Tags, "  ")
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintInfoAboutExifThumbnail(exifData As Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData)
            System.Console.WriteLine("EXIF thumbnail:")
    
            Using thumbnailImage As Vintasoft.Imaging.VintasoftImage = exifData.GetThumbnail()
                    ' print info about EXIF thumbnail
                    System.Console.WriteLine(String.Format("  Thumbnail size: {0}x{1}", thumbnailImage.Width, thumbnailImage.Height))
            End Using
    
            System.Console.WriteLine()
    End Sub
    
    Private Sub PrintExifTagCollectionInfo(tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection, indent As String)
            ' print tag count
            System.Console.WriteLine(String.Format("{0}Tags [{1}]:", indent, tags.Count))
            ' for each tag
            For i As Integer = 0 To tags.Count - 1
                    ' print tag info
                    System.Console.WriteLine(String.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags(i).Id, tags(i).Name, tags(i).Data))
    
                    ' if tag data is TiffImageFileDirectory
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory) Then
                            Dim subIfd As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)
                            ' print info about tag collection of sub IFD
                            PrintExifTagCollectionInfo(subIfd.Tags, indent & "  ")
                    End If
                    ' if tag data is TiffImageFileDirectory[]
                    If tags(i).Data.[GetType]() Is GetType(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory()) Then
                            Dim subIfds As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory() = DirectCast(tags(i).Data, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory())
                            For j As Integer = 0 To subIfds.Length - 1
                                    ' print info about tag collection of sub IFD
                                    PrintExifTagCollectionInfo(subIfds(j).Tags, indent & "  ")
                            Next
                    End If
            Next
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void PrintExifInfoAboutJpegFile(string filename)
    {
        // create an instance of JpegFile class
        using (Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile jpegFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename))
        {
            // if JPEG page contains EXIF information
            if (jpegFile.Page.Exif != null)
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData exifData = jpegFile.Page.Exif;
    
                // if EXIF data is found
                if (exifData.ImageFileDirectory != null)
                    // print info about EXIF data
                    PrintInfoAboutExifData(exifData.ImageFileDirectory);
    
                // if EXIF thumbnail data is found
                if (exifData.ThumbnailFileDirectory != null)
                    // print info about EXIF thumbnail data
                    PrintInfoAboutExifThumbnailData(exifData.ThumbnailFileDirectory);
    
                // if EXIF thumbnail is found
                if (exifData.HasThumbnail)
                    // print info about EXIF thumbnail
                    PrintInfoAboutExifThumbnail(exifData);
            }
        }
    }
    
    private void PrintInfoAboutExifData(
        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory exifDataIfd)
    {
        System.Console.WriteLine("EXIF data:");
    
        // print info about tag collection of EXIF data
        PrintExifTagCollectionInfo(exifDataIfd.Tags, "  ");
    
        System.Console.WriteLine();
    }
    
    private void PrintInfoAboutExifThumbnailData(
        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory exifThumbnailDataIfd)
    {
        System.Console.WriteLine("EXIF thumbnail data:");
    
        // print info about tag collection of EXIF thumbnail data
        PrintExifTagCollectionInfo(exifThumbnailDataIfd.Tags, "  ");
    
        System.Console.WriteLine();
    }
    
    private void PrintInfoAboutExifThumbnail(
        Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData exifData)
    {
        System.Console.WriteLine("EXIF thumbnail:");
    
        using (Vintasoft.Imaging.VintasoftImage thumbnailImage = exifData.GetThumbnail())
        {
            // print info about EXIF thumbnail
            System.Console.WriteLine(string.Format("  Thumbnail size: {0}x{1}", thumbnailImage.Width, thumbnailImage.Height));
        }
    
        System.Console.WriteLine();
    }
    
    private void PrintExifTagCollectionInfo(
        Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags, string indent)
    {
        // print tag count
        System.Console.WriteLine(string.Format("{0}Tags [{1}]:", indent, tags.Count));
        // for each tag
        for (int i = 0; i < tags.Count; i++)
        {
            // print tag info
            System.Console.WriteLine(string.Format("{0}- Id={1}, Name={2}, Data={3}", indent, tags[i].Id, tags[i].Name, tags[i].Data));
            
            // if tag data is TiffImageFileDirectory
            if (tags[i].Data.GetType() == typeof(
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory subIfd = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory)tags[i].Data;
                // print info about tag collection of sub IFD
                PrintExifTagCollectionInfo(subIfd.Tags, indent + "  ");
            }
            // if tag data is TiffImageFileDirectory[]
            if (tags[i].Data.GetType() == typeof(
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[]))
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[] subIfds = 
                    (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffImageFileDirectory[])tags[i].Data;
                for (int j = 0; j < subIfds.Length; j++)
                    // print info about tag collection of sub IFD
                    PrintExifTagCollectionInfo(subIfds[j].Tags, indent + "  ");
            }
        }
    }
                    
    


    Here is an example showing how to change GPS information about JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Sub ChangeGpsInfoAboutJpegFile(filename As String)
            ' create an instance of JpegFile class
            Using jpegFile As New Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename)
                    ' if JPEG page contains EXIF information
                    If jpegFile.Page.Exif IsNot Nothing Then
                            Dim exifData As Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData = jpegFile.Page.Exif
    
                            ' if EXIF data is found
                            If exifData.ImageFileDirectory IsNot Nothing Then
                                    ' if GPS info is not found
                                    If exifData.ImageFileDirectory.GpsTags Is Nothing Then
                                            ' create tag collection that contains GPS info
                                            exifData.ImageFileDirectory.GpsTags = New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection()
                                    End If
    
                                    ' get reference to a GPS tags
                                    Dim gpsTags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection = exifData.ImageFileDirectory.GpsTags
    
                                    ' search for tag that contains info about GPS date stamp
                                    Dim gpsDateStampTag As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag = gpsTags.Find(CUShort(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp))
                                    ' if tag that contains info about GPS date stamp is found
                                    If gpsDateStampTag IsNot Nothing Then
                                            ' change the tag data
                                            gpsDateStampTag.Data = System.DateTime.Now.ToString()
                                    Else
                                            ' if tag that contains info about GPS date stamp is not found
                                            ' add the GPS date stamp
                                            gpsTags.Add(CUShort(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp), System.DateTime.Now.ToString())
                                    End If
    
                                    ' save changes to the source file
                                    jpegFile.SaveChanges()
                            End If
                    End If
            End Using
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public void ChangeGpsInfoAboutJpegFile(string filename)
    {
        // create an instance of JpegFile class
        using (Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile jpegFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename))
        {
            // if JPEG page contains EXIF information
            if (jpegFile.Page.Exif != null)
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData exifData = jpegFile.Page.Exif;
    
                // if EXIF data is found
                if (exifData.ImageFileDirectory != null)
                {
                    // if GPS info is not found
                    if (exifData.ImageFileDirectory.GpsTags == null)
                        // create tag collection that contains GPS info
                        exifData.ImageFileDirectory.GpsTags = 
                            new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection();
    
                    // get reference to a GPS tags
                    Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection gpsTags = 
                        exifData.ImageFileDirectory.GpsTags;
    
                    // search for tag that contains info about GPS date stamp
                    Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTag gpsDateStampTag = 
                        gpsTags.Find((ushort)Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp);
                    // if tag that contains info about GPS date stamp is found
                    if (gpsDateStampTag != null)
                        // change the tag data
                        gpsDateStampTag.Data = System.DateTime.Now.ToString();
                    // if tag that contains info about GPS date stamp is not found
                    else
                        // add the GPS date stamp
                        gpsTags.Add((ushort)Vintasoft.Imaging.Codecs.ImageFiles.Tiff.GpsTagId.GPSDateStamp, 
                            System.DateTime.Now.ToString());
    
                    // save changes to the source file
                    jpegFile.SaveChanges();
                }
            }
        }
    }
                    
    


    Here is an example showing how to get thumbnail of JPEG file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Public Function GetJpegThumbnail(filename As String) As Vintasoft.Imaging.VintasoftImage
            ' create an instance of JpegFile class
            Using jpegFile As New Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename)
                    ' if JPEG page contains EXIF information
                    If jpegFile.Page.Exif IsNot Nothing Then
                            Dim exifData As Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData = jpegFile.Page.Exif
    
                            ' if EXIF thumbnail is found
                            If exifData.HasThumbnail Then
                                    ' return thumbnail of JPEG page
                                    Return exifData.GetThumbnail()
                            End If
                    End If
    
                    ' JPEG page does not have thumbnail
                    Return Nothing
            End Using
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    public Vintasoft.Imaging.VintasoftImage GetJpegThumbnail(string filename)
    {
        // create an instance of JpegFile class
        using (Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile jpegFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.JpegFile(filename))
        {
            // if JPEG page contains EXIF information
            if (jpegFile.Page.Exif != null)
            {
                Vintasoft.Imaging.Codecs.ImageFiles.Jpeg.ExifData exifData = jpegFile.Page.Exif;
    
                // if EXIF thumbnail is found
                if (exifData.HasThumbnail)
                    // return thumbnail of JPEG page
                    return exifData.GetThumbnail();
            }
    
            // JPEG page does not have thumbnail
            return null;
        }
    }
                    
    



    Access to metadata of instance of PdfDocument class

    PdfDocument class provides access to PDF document. Metadata of PDF document can be obtained using properties and methods of instance of PdfDocument class. Also the instance of PdfDocument class provides access to PDF file pages.

    Here is an example showing how to obtain information about PDF document:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging.Pdf
    
    Public Sub GetPdfDocumentInfo(filename As String)
            ' create an instance of PdfDocument class
            Using pdfDocument As New Vintasoft.Imaging.Pdf.PdfDocument(filename)
                    System.Console.WriteLine(String.Format("PDF document: '{0}'", filename))
    
                    Dim documentInformation As Vintasoft.Imaging.Pdf.Tree.PdfDocumentInformation = pdfDocument.DocumentInformation
                    System.Console.WriteLine(String.Format("  Creator: {0}", documentInformation.Creator))
                    System.Console.WriteLine(String.Format("  Producer: {0}", documentInformation.Producer))
                    System.Console.WriteLine(String.Format("  Creation date: {0}", documentInformation.CreationDate))
                    System.Console.WriteLine(String.Format("  Last modification date: {0}", documentInformation.ModifyDate))
                    System.Console.WriteLine(String.Format("  Author: {0}", documentInformation.Author))
                    System.Console.WriteLine(String.Format("  Title: {0}", documentInformation.Title))
                    System.Console.WriteLine(String.Format("  Subject: {0}", documentInformation.Subject))
                    System.Console.WriteLine(String.Format("  Keywords: {0}", documentInformation.Keywords))
            End Using
    End Sub
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging.Pdf
    
    public void GetPdfDocumentInfo(string filename)
    {
        // create an instance of PdfDocument class
        using (Vintasoft.Imaging.Pdf.PdfDocument pdfDocument = 
            new Vintasoft.Imaging.Pdf.PdfDocument(filename))
        {
            System.Console.WriteLine(string.Format("PDF document: '{0}'", filename));
    
            Vintasoft.Imaging.Pdf.Tree.PdfDocumentInformation documentInformation = pdfDocument.DocumentInformation;
            System.Console.WriteLine(string.Format("  Creator: {0}", documentInformation.Creator));
            System.Console.WriteLine(string.Format("  Producer: {0}", documentInformation.Producer));
            System.Console.WriteLine(string.Format("  Creation date: {0}", documentInformation.CreationDate));
            System.Console.WriteLine(string.Format("  Last modification date: {0}", documentInformation.ModifyDate));
            System.Console.WriteLine(string.Format("  Author: {0}", documentInformation.Author));
            System.Console.WriteLine(string.Format("  Title: {0}", documentInformation.Title));
            System.Console.WriteLine(string.Format("  Subject: {0}", documentInformation.Subject));
            System.Console.WriteLine(string.Format("  Keywords: {0}", documentInformation.Keywords));
        }
    }
                    
    


    PdfPage class provides access to page of PDF document. Metadata of PDF page can be obtained using properties and methods of instance of PdfPage class.


    Here is an example showing how to get size of PDF document page:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging.Pdf
    
    Public Function GetFirstPdfPageSize(filename As String) As System.Drawing.SizeF
            ' create an instance of PdfDocument class
            Using pdfDocument As New Vintasoft.Imaging.Pdf.PdfDocument(filename)
                    If pdfDocument.Pages.Count = 0 Then
                            Return System.Drawing.SizeF.Empty
                    End If
    
                    Return pdfDocument.Pages(0).Size
            End Using
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging.Pdf
    
    public System.Drawing.SizeF GetFirstPdfPageSize(string filename)
    {
        // create an instance of PdfDocument class
        using (Vintasoft.Imaging.Pdf.PdfDocument pdfDocument =
            new Vintasoft.Imaging.Pdf.PdfDocument(filename))
        {
            if (pdfDocument.Pages.Count == 0)
                return System.Drawing.SizeF.Empty;
    
            return pdfDocument.Pages[0].Size;
        }
    }
                    
    


    Here is an example showing how to get thumbnail of PDF document page:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    ' - Vintasoft.Imaging.Pdf
    
    Public Function GetFirstPdfPageThumbnail(filename As String) As Vintasoft.Imaging.VintasoftImage
            ' create an instance of PdfDocument class
            Using pdfDocument As New Vintasoft.Imaging.Pdf.PdfDocument(filename)
                    If pdfDocument.Pages.Count = 0 Then
                            Return Nothing
                    End If
    
                    Return pdfDocument.Pages(0).GetThumbnail(100, 100)
            End Using
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    // - Vintasoft.Imaging.Pdf
    
    public Vintasoft.Imaging.VintasoftImage GetFirstPdfPageThumbnail(string filename)
    {
        // create an instance of PdfDocument class
        using (Vintasoft.Imaging.Pdf.PdfDocument pdfDocument = 
            new Vintasoft.Imaging.Pdf.PdfDocument(filename))
        {
            if (pdfDocument.Pages.Count == 0)
                return null;
    
            return pdfDocument.Pages[0].GetThumbnail(100, 100);
        }
    }