Write
Writes image data to a TIFF file.
Syntax
void Write( pData, lRows, lCols );
Parameters
void *pData
Pointer to the image data.
long lRows
The image row dimension ( in pixels ).
long lCols
The image column dimension ( in pixels ).
Returns
None
Required Headers
CTiffFile.h
Namespace
arc
Throws
std::runtime_error
Remarks
The image data must be 16 bits-per-pixel.
Example
        // This code demonstrates how to create a TIFF file
        // that contains a 2048x2200 pixel gradient image.

        #include <iostream>
        #include "CTiffFile.h"

        using namespace std;
        using namespace arc;

        int main()
        {
            unsigned short *pBuf = NULL;
            unsigned short  val  = 0;

            try {
                //
                // Create a new buffer and fill it with a gradient
                //
                pBuf = new unsigned short[ 2048 * 2200 ];
 
                if ( pBuf == NULL )
                {
                    cerr << "Error: failed to create buffer!" << endl;
                    exit( 1 );
                }

                for ( int r=0; r<2048; r++ )
                {
                    for ( int c=0; c<2200; c++ )
                        pBuf[ c + r * 2200 ] = val;

                    val++;
                    if ( val >= 65535 ) val = 0;
                }

                //
                // Write the buffer to a TIFF file
                //
                CTiffFile cTiff( "Image.tif" );
                cTiff.Write( pBuf, 2048, 2200 );
            }
            catch ( std::exception &e )
            {
                cerr << "Exception Occurred: " << e.what() << endl;
            }
            catch ( ... )
            {
                cerr << "System Exception Occurred!" << endl;
            }
        }

© Astronomical Research Cameras, Inc.