LTwain::GetJPEGCompression

Summary

Gets the current or default JPEG compression settings for the session.

Syntax

#include "ltwrappr.h"

L_INT LTwain::GetJPEGCompression (pTwJpegComp, uFlag);

Parameters

pTW_JPEGCOMPRESSION pTwJpegComp

Pointer to a TW_JPEGCOMPRESSION structure to be updated with the JPEG compression settings.

L_UINT uFlag

Flag that indicates which type of JPEG compression values to get. Possible values are:

Value Meaning
LTWAIN_GET_JPEG_COMPRESSION [0x0001] Get the current JPEG compression settings.
LTWAIN_GET_DEFAULT_JPEG_COMPRESSION [0x0002] Get the default JPEG compression settings.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function will get the current or default TWAIN JPEG compression settings, depending on the flag passed to the uFlag parameter.

For more information about TW_JPEGCOMPRESSION, refer to the TWAIN specification.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LTwain__GetJPEGCompressionExample(LTwain * plTwain) 
 
{ 
   L_INT                nRet; 
   TW_JPEGCOMPRESSION   myJPEG;  
 
   memset(&myJPEG, 0, sizeof(TW_JPEGCOMPRESSION));  
 
   nRet = plTwain->GetJPEGCompression(&myJPEG, LTWAIN_GET_JPEG_COMPRESSION);  
 
   if (nRet == SUCCESS)  
 
   { 
 
      myJPEG.ColorSpace = TWPT_GRAY;  
 
      myJPEG.SubSampling = 0x10001000;  
 
      myJPEG.NumComponents = 1;  
 
      myJPEG.RestartFrequency = 0;  
 
      myJPEG.QuantMap[0] = 0;  
 
      memset(&myJPEG.QuantTable[0], 0, sizeof(TW_MEMORY));  
 
      myJPEG.HuffmanMap[0] = 0;  
 
      memset(&myJPEG.HuffmanDC[0], 0, sizeof(TW_MEMORY));  
 
      memset(&myJPEG.HuffmanAC[0], 0, sizeof(TW_MEMORY));  
 
      nRet = plTwain->SetJPEGCompression (&myJPEG, LTWAIN_SET_JPEG_COMPRESSION);  
 
      if (nRet == SUCCESS)  
 
         MessageBox(NULL, TEXT("Set JPEG compression options is success"), TEXT("Notice!"), MB_OK);  
 
      else 
 
         return nRet; 
 
   } 
   else 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.