InsertTiffImage

#include "BITIFF.H"

 

BOOL CALLBACK InsertTiffImage( LPTSTR    lpszFileName,
HANDLE hDIB,
UINT        wCompMode,
BOOL       DisplayDlg,
int              nFillOrder
int              nImage
BOOL       bFast
BOOL       bChange)

Description

Saves the device independent bitmap (hDIB) in the TIFF file named lpszFileName. Does all low level calls internally in the DLL. To retrieve the last error, use the TiffErrorString(). The wCompMode must be set to one of the compression types defined in the Document Imaging SDK USER’S GUIDE. The wCompMode is ignored if DisplayDlg is set to TRUE.

The following compression types are defined in BITIFF.H.

            Compression type -     TCOMP_NOCOMP               - No compression

                                                TCOMP_PACKBITS             - Packbit

                                                TCOMP_LZW                        - LZW

                                                TCOMP_LZW_DIFF             - LZW with differentiation

                                                TCOMP_CCITTG2                - CCITT Group 3 1D NO EOL

                                                TCOMP_CCITTG31D           - CCITT Group 3 1D

                                                TCOMP_CCITTG32D           - CCITT Group 3 2D

                                                TCOMP_CCITTG4                - CCITT Group 4

                                                TCOMP_JPEG                       - JPEG

 

If the 'DisplayDlg' is set to TRUE, a dialog box is displayed with the different options to save the bitmap in the TIFF file.

The BITIFF.H contains the defines for

Bit order -        NORM_BIT_ORDER (1)      - High to Low

REV_BIT_ORDER (2)                      - Low to High

Parameters

LPTSTR

lpszFileName

Path to the TIFF file.

HANDLE

hDIB

Device independent bitmap to be inserted or changed.

UINT

wCompMode

Compression type.

BOOL

DisplayDlg

Display dialog box.

int

nFillOrder

Fill order.

int

nImage

The zero based position to insert or change the image at.

BOOL

bFast

If TRUE, Document Imaging SDK uses the fast saving method. Otherwise the slow one is used.

BOOL

bChange

If TRUE, the specified image will be changed with the new
one. Otherwise the new image will be inserted at the given
position.

Additional Information

This example shows how to use the dll when loading statically including the header file. Otherwise if the dll is loaded dynamically, for further information read the “About the difference of static and dynamic library loading” section of the manual.

Return values

TRUE on success, otherwise FALSE.

Programming notes

The fast saving method indicated by the bFast parameter always appends the image at the end of the file physically and modifies the Image File Directory only. It is fast, because the images are not moved from a position to another position. Use this method when you should insert or change a large number of images at once. If you finished inserting or changing images, you can call the ReorderTiffFile() function to reorder the file based on the Image File Directory (thus the physical image order will be the same as the logical). Calling the function with the bFast parameter set to TRUE for ONE image and then calling the ReorderTiffFile() is the same as calling the function with the bFast parameter set to FALSE.

If nImage is less than 0, the function does nothing and returns immediately with FALSE.

If nImage is greater than the number of images in the TIFF file, the new image will be appended to the end of the file regardless the specified position and the bChange parameter.

This function was designed to be used with high-level application generators like Borland C++, Visual Basic.

Requirements

Header :     Declared in BiTiff.h; include BiTiff.h.

Library :    Use BiTIFF.lib.

DLLs :       BiTiff.dll.

References to related functions

See DeleteTiffImage(), ReorderTiffFile().