←Select platform

ColorComponentCount Property

Summary
Gets or sets the number of color components in the image to be compressed. This property is updated by calling the GetJpegCompression method. To set the JPEG Compression options, set this property and the other TwainJpegCompression properties and call the SetJpegCompression method.

Syntax
C#
C++/CLI
Python
public int ColorComponentCount { get; set; } 
public: 
property int ColorComponentCount { 
   int get(); 
   void set (    int ); 
} 
ColorComponentCount # get and set (TwainJpegCompression) 

Property Value

The number of color components in the image to be compressed.

Remarks

For more information, refer to Using JPEG Compression For A TWAIN Source. For more information about TW_JPEGCOMPRESSION, refer to the TWAIN specification.

Example
C#
using Leadtools; 
using Leadtools.Twain; 
 
 
public void SetJpegCompressionExample(IntPtr parent) 
{ 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   try 
   { 
      TwainJpegCompression myJpeg = session.GetJpegCompression(false); 
      TwainMemoryData[] data = new TwainMemoryData[1]; 
 
      myJpeg.ColorScheme = TwainColorScheme.Gray; 
      myJpeg.SubSampling = 0x10001000; 
      myJpeg.ColorComponentCount = 1; 
      myJpeg.RestartFrequency = 0; 
 
      int[] quantMap = new int[1]; 
      quantMap[0] = 0; 
      myJpeg.SetQuantizationMap(quantMap); 
 
      int[] haffmanMap = new int[1]; 
      haffmanMap[0] = 0; 
      myJpeg.SetHuffmanMap(haffmanMap); 
      myJpeg.SetQuantizationTable(data); 
      myJpeg.SetHuffmanDC(data); 
      myJpeg.SetHuffmanAC(data); 
 
      session.SetJpegCompression(myJpeg, false); 
      MessageBox.Show("Set JPEG compression options is success"); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
 
   session.Shutdown(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.