Using JPEG Compression for a TWAIN Source

LEADTOOLS provides the functionality to get and set JPEG compression options for a TWAIN source. The user can get the current or default JPEG compression options for the current TWAIN session by calling the GetJPEGCompression method.

The GetJPEGCompression method updates the JPEGCompressionData property. The JPEGCompressionData property is a pointer to an ITwainJpegCompression object, which contains the following properties:

ColorSpace property

HuffmanAC property

HuffmanDC property

HuffmanMap property

NumComponents property

QuantMap property

QuantTable property

RestartFrequency property

SubSampling property

To set the JPEG Compression options for the current TWAIN session, set the properties listed above, accessed through the JPEGCompressionData property, and then call the SetJPEGCompression method.

The QuantTable, HuffmanDC and HuffmanAC properties, listed above, are each pointers to an array of ITwainMemoryData objects. Each ITwainMemoryData object contains the following properties:

Flags property

Length property

Data property

These properties are updated through the QuantTable, HuffmanDC and HuffmanAC properties when the GetJPEGCompression method is called.

For the QuantTable, HuffmanDC and HuffmanAC properties, set the properties listed above for each entry in the array, before calling the SetJPEGCompression method.