DTWAIN_SetJpegValues |
Top Previous Next |
The DTWAIN_SetJpegValues function sets the quality of an acquired JPEG file as well as whether it is a progressive JPEG.
DTWAIN_BOOL DTWAIN_SetJpegValues (
Parameters Source An open TWAIN Source.
Quality The JPEG quality factor
bProgressive Determines whether the JPEG file will be a progressive JPEG file.
Return Values The return value is TRUE if successful. Otherwise FALSE is returned.
Comments The DTWAIN_SetJpegValues function sets the current quality and progressive nature of an acquired JPEG file. The Quality parameter determines the quality of the JPEG image. The quality determines the amount of detail the image will contain with respect to the original image acquired. The quality factor is numbered from 1 (low quality) to 100 (no loss -- very high quality). The higher the quality factor, the larger in size the acquired JPEG file will be. By default, the quality setting is 75, which is adequate for most JPEG files.
The bProgressive argument determines whether the JPEG file will be a progressive JPEG file. In simple terms, a progressive JPEG file is one where the display of such files in a web browser causes it to "progressively" display. This allows larger JPEG files to partially show themselves when rendered in a browser, improving as more data is recieved by the browser. By default, the progressive setting is FALSE (no progressive file). With a non-progressive JPEG file, a browser would have to wait until the entire file is recieved before displaying in a browser.
Note that DTWAIN_SetJpegValues only pertain to JPEG files acquired using DTWAIN file mode. If acquiring JPEG files using the Twain Source's internal file support, this function cannot be used. See below for more information.
Setting the JPEG quality factor for devices that support JPEG transfers
For setting the JPEG quality factor for internal file support, use DTWAIN_SetCapValues using DTWAIN_CV_ICAPJPEGQUALITY as the capability to set, and a DTWAIN_ARRAYLONG as the container to use. Below is an example:
#include <dtwain.h> #include <tchar.h> // for Windows _T macro to denote string type
void ExampleFunction( ) { DTWAIN_SOURCE TheSource; /* The TWAIN Data Source */ LONG QualityFactor; DTWAIN_ArraySetAtLong( ArrayLong, 0, 80) ; DTWAIN_SetCapValues( TheSource, DTWAIN_CV_ICAPJPEGQUALITY, DTWAIN_CAPSET, ArrayLong ); //... }
TWAIN State Transitions The Source must be in State 4. or higher
Prerequisite Function Call(s)
DTWAIN Source Selection Function
See Also
|