Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Sunshow Pro V3.0 - <b>tifinfo()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
TIFInfo()

Reads a TIFF file header and returns image information


Syntax

TIFInfo(<cFILE.TIF>, @<nLeft>, @<nTop>, @<nWidth>, ;
   @<nHeight>, @<nNumColors>, @<nBitsPerPixel>)


Arguments

<cFILE.TIF>
Name of the TIFF image file, and optional drive and path.

<nLeft>
Horizontal starting left coordinate of the image.

<nTop>
Vertical starting top coordinate of the image.

<nWidth>
Horizontal width of the image.

<nHeight>
Vertical height of the image.

<nNumColors>
Number of colors contained in the image.

<nBitsPerPixel>
Number of bits per pixel.


Returns

0
Success. If successful, function returns <nLeft>, <nTop>, <nWidth>, 
<nHeight>, <nNumColors>, and <nBitsPerPixel> from the image file.

-1
Cannot open <cFILE.TIF>.

-2
This is not a TIFF Image file.

-4
Cannot allocate memory for line buffers.

-5
LSEEK error: file is truncated.

-7
TIFF Image width tag is missing.

-8
TIFF Image height tag is missing.

-99
Parameters are invalid.


Remarks

TIFInfo() reads the header of 1- through 8- or 24-bit TIFF, Versions 
4.2/5.0/6.0 image file and returns information about <cFILE.TIF>. <nLeft>, 
<nTop>, <nWidth>, <nHeight>, <nNumColors>, and <nBitsPerPixel> must be 
initialized before-hand and passed by reference by prefacing the variable 
with the pass-by-reference operator (@). If <nBitsPerPixel> is less than 
or equal to 8 then <nNumColors> will contain the number of colors in the 
file, otherwise, <nNumColors> will equal zero and <nNumColors> must be 
calculated from the <nBitsPerPixel> (<nNumColors> = 2 to the power of 
<nBitsPerPixel>).

For other examples of how to use the <EXT>Info() image analysis functions, 
see SUNINFO.PRG, an example program distributed with Sunshow.


Example

nLeft = 0
nTop = 0
nWidth = 0
nHeight = 0
nNumColors = 0
nBitsPerPixel = 0
cFileName = "FILE.TIF"
nStatus = TIFInfo(cFileName, @nLeft, @nTop, @nWidth, ;
   @nHeight, @nNumColors, @nBitsPerPixel)
IF nStatus < 0
     DO CASE
    CASE nStatus = -1
        ? "Cannot open ", cFileName
    CASE nStatus = -2
        ? cFileName, " is not a TIF image file"
    CASE nStatus = -4
        ? "Cannot allocate memory for line buffers"
    CASE nStatus = -5
        ? "LSEEK error: file is truncated"
    CASE nStatus = -7
        ? "TIF image width tag is missing"
    CASE nStatus = -8
        ? "TIF image height tag is missing"
    CASE nStatus = -99
        ? "Parameters are invalid"
     ENDCASE
     RETURN
ENDIF



See Also: JPEGInfo()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson