EncodeTiffImage

#include "BITIFF.H"

 

BOOL CALLBACK EncodeTiffImage( TIFFFILE    hChain,
                                                                 int                 nImage,
                                                                 INT_PTR     lUserData,
                                                                 FILLPROC  lpLineFn)

Description

Compresses an image into a TIFF file. The raw image data must be passed to the function through the user defined callback function line by line. All information must have been prepared by previous calls of DefineTiffImageInfo() and other functions.

Document Imaging SDK supports multiple image TIFF files.

Parameters

TIFFFILE

hChain

TIFF image chain handle.

int

nImage

Index of the image in the chain.

INT_PTR

lUserData

User defined info. It is passed to the callback function as a third parameter unchanged.

FILLPROC

lpLineFn

Callback function that will pass the raw DIB lines to the function.

Return values

TRUE on success, FALSE if failed. It sets the error flag to TUNKNOWNCOMPRESSION if the compression type of the image is not supported, or to TCOMPRESSIONFAILED if the compression has failed.

Programming notes

The callback function pointed by the lpLineFn parameter must use the Pascal calling convention and must have the following form:

int CALLBACK LineFn(LPSTR lpLineBuff, int nLine, INT_PTR lParam)

LineFn is a placeholder for the application-supplied function name. You can use any other name for this purpose.

Parameters

LPSTR

lpLineBuff

Buffer to put a single line DIB into (of course, without header).

int

nLine

Index of the required line. Line numbers are started from zero.

INT_PTR

lParam

The lUserData parameter of the EncodeTiffImage() function.

The user can use this parameter freely.

Return values

Error status. TOK if OK.

Using a callback function for this purpose provides you with the possibility for advanced bitmap handling (e.g. direct image transport from clipboard, DDE pipe, from another file to TIFF). So you are not forced to keep the whole - possibly huge - image in your applications memory.

Requirements

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

Library :    Use BiTIFF.lib.

DLLs :       BiTiff.dll.

References to related functions

See DecodeCcittImage(), DecodeTiffImage() and EncodeCcittImage().

Code example

See example at DecodeCcittImage().