DTwainCompressedTransfer::GetBestCompressionType

Top  Previous  Next

Syntax

 

DTwainCompressionType DTwainCompressedTransfer::GetBestCompressionType( DTwainCompressionType CompType,

                                                                                                                                 bool bIsMono = false ) const;

 

 

Parameters

CompType

The general compression type to use when checking for the best compression available.

 

bIsMono

Return the best compression if acquiring to a monochrome image (1 bit-per-pixel).

 

 

 

Return Value

Returns the compression type that creates the smallest image size (in bytes)

 

Comments

 

 

The CompType parameter must be one of the following:

 

COMPRESS_BMP

BMP compression

COMPRESS_TIFF    

TIFF compression

COMPRESS_JPEG

Compression using JPEG encoding.

COMPRESS_PNG

Compression using PNG encoding.

 

The bIsMono parameter should be true if the image acquired will be a 1-bit-per-pixel image.  Currently, a value of true for bIsMono is only recognized if the CompType is COMPRESS_TIFF.

 

COMPRESS_NONE

No compression (all Twain Sources must support "no compresion").

COMPRESS_PACKBITS    

Compression using PackBits format.

COMPRESS_GROUP31D    

Compression using Group 3 encoding.

COMPRESS_GROUP31DEOL

Compression using Group 3 encoding.

COMPRESS_GROUP32D

Compression using Group 3 encoding.

COMPRESS_GROUP4

Compression using Group 4 encoding.

COMPRESS_JPEG

Compression using JPEG encoding.

COMPRESS_LZW

Compression using LZW encoding.

COMPRESS_JBIG

Compression using JBIG encoding.

COMPRESS_PNG

Compression using PNG encoding.

COMPRESS_RLE4

Compression using Run Length encoding.

COMPRESS_RLE8

Compression using Run Length encoding.

COMPRESS_BITFIELDS

Compression using Bitfields encoding.

 

An example of usage of this function would be if you want to get the best TIFF compression.  A CompType value of COMPRESS_TIFF may return COMPRESS_LZW, COMPRESS_NONE, COMPRESS_GROUP4 (if the bIsMono flag is set to true), etc.