VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    TIFF: How to get information about TIFF file?
    In This Topic
    Here is C#/VB.NET code that shows how to get information about TIFF file:
    namespace UserGuide.Programming.Tiff
    {
        class GetInformationAboutTIFF
        {
    
            public static void GetInfoAboutTiff(string fileName)
            {
                // open TIFF file
                using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiff = 
                    new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(fileName))
                {
                    System.Console.WriteLine(string.Format("Pages count: {0}", tiff.Pages.Count));
    
                    // for each page of TIFF file
                    Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffPage page;
                    for (int i = 0; i < tiff.Pages.Count; i++)
                    {
                        // show information about image of TIFF page
                        page = tiff.Pages[i];
                        System.Console.WriteLine(string.Format("  Page {0}:", i));
                        System.Console.WriteLine(string.Format("  - Width = {0}", page.Width));
                        System.Console.WriteLine(string.Format("  - Height = {0}", page.Height));
                        System.Console.WriteLine(string.Format("  - BitsPerPixel = {0}", page.BitsPerPixel));
                        System.Console.WriteLine(string.Format("  - Resolution = {0}", page.Resolution));
                        System.Console.WriteLine(string.Format("  - Palette Colors Count = {0}", page.Palette.ColorCount));
                        System.Console.WriteLine(string.Format("  - Compression = {0}", page.Compression));
                    }
                }
            }
    
        }
    }
    
    Namespace UserGuide.Programming.Tiff
        Class GetInformationAboutTIFF
    
            Public Shared Sub GetInfoAboutTiff(fileName As String)
                ' open TIFF file
                Using tiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(fileName)
                    System.Console.WriteLine(String.Format("Pages count: {0}", tiff.Pages.Count))
    
                    ' for each page of TIFF file
                    Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffPage
                    For i As Integer = 0 To tiff.Pages.Count - 1
                        ' show information about image of TIFF page
                        page = tiff.Pages(i)
                        System.Console.WriteLine(String.Format("  Page {0}:", i))
                        System.Console.WriteLine(String.Format("  - Width = {0}", page.Width))
                        System.Console.WriteLine(String.Format("  - Height = {0}", page.Height))
                        System.Console.WriteLine(String.Format("  - BitsPerPixel = {0}", page.BitsPerPixel))
                        System.Console.WriteLine(String.Format("  - Resolution = {0}", page.Resolution))
                        System.Console.WriteLine(String.Format("  - Palette Colors Count = {0}", page.Palette.ColorCount))
                        System.Console.WriteLine(String.Format("  - Compression = {0}", page.Compression))
                    Next
                End Using
            End Sub
    
        End Class
    End Namespace