FileType Example VB

This example shows how you can use the CompressionType, FileType, ImageHeight, ImageResolutionX, ImageResolutionY, ImageWidth and PageCount properties to request information about a file. Attributes for specific page of a specific file will be displayed.

Private Sub cmdGetInfo_Click()
    Dim strImgFileType, strImgCompType, strImgPageType As String 
    ImgAdmin1.Image = "D:\image2\4page.tif"
    'Must specify page number if other than page 1
    ImgAdmin1.PageNumber = 2 
    'Load the form where we will display file attributes.
    Load frmInfo
    'Read the Filetype property and translate the value to
    'a corresponding string.
    Select Case ImgAdmin1.FileType
        Case 0
            strImgFileType = "Unknown"
        Case 1
            strImgFileType = "TIF"
        Case 2
            strImgFileType = "AWD"
        Case 3
            strImgFileType = "BMP"
        Case 4
            strImgFileType = "PCX"
        Case 5
            strImgFileType = "DCX"
        Case 6
            strImgFileType = "JPG"
        Case 7
            strImgFileType = "XIF"
        Case 8
            strImgFileType = "GIF"
        Case 9
            strImgFileType = "WIF"
    End Select 
    frmInfo.lblImgInfo(0).Caption = strImgFileType
    'Read the CompressionType property and translate the value to 
    'a corresponding string.
    Select Case ImgAdmin1.CompressionType
        Case 0
            strImgCompType = "Unknown"
        Case 1
            strImgCompType = "No Compression"
        Case 2
            strImgCompType = "Group3(1D)"
        Case 3
            strImgCompType = "Group3(Modified Huffman)"
        Case 4
            strImgCompType = "PackBits"
        Case 5
            strImgCompType = "Group4(2D)"
        Case 6
            strImgCompType = "JPEG"
        Case 7
            strImgCompType = "RBA"
        Case 8
            strImgCompType = "Group3(2D)"
        Case 9
            strImgCompType = "LZW" 
    End Select
    frmInfo.lblImgInfo(1).Caption = strImgCompType 
    'Read the PageType property and translate the value to a
    'corresponding string.
    Select Case ImgAdmin1.PageType
        Case 0
            strImgPageType = "Unknown"
        Case 1
            strImgPageType = "Black and White"
        Case 2
            strImgPageType = "4 bit grayscale"
        Case 3
            strImgPageType = "8 bit grayscale"
        Case 4
            strImgPageType = "4 bit palettized"
        Case 5
            strImgPageType = "8 bit palettized"
        Case 6
            strImgPageType = "24 bit RGB"
        Case 7
            strImgPageType = "24 bit BGR"
End Select
    frmInfo.lblImgInfo(6).Caption = strImgPageType 
    'Determine the dimensions of the image page.
    frmInfo.lblImgInfo(2).Caption = ImgAdmin1.ImageHeight
    frmInfo.lblImgInfo(3).Caption = ImgAdmin1.ImageWidth 
    'Determine the X and Y resolution of the image page.
    frmInfo.lblImgInfo(4).Caption = ImgAdmin1.ImageResolutionX
    frmInfo.lblImgInfo(5).Caption = ImgAdmin1.ImageResolutionY 
    'Determine the number of pages in the file.
    frmInfo.lblImgInfo(7).Caption = ImgAdmin1.PageCount 
    'Show the form with the image attributes.
    frmInfo.Show
End Sub