Sets the JPEG compression options for the current TWAIN session. This method lets the user set JPEG compression options for the current TWAIN session or reset the default JPEG compression options for the current TWAIN session, depending on the flag passed to the flag parameter.
public void SetJpegCompression(TwainJpegCompression compression,bool resetValues)
Public Sub SetJpegCompression( _ByVal compression As Leadtools.Twain.TwainJpegCompression, _ByVal resetValues As Boolean _)
public:void SetJpegCompression(Leadtools.Twain.TwainJpegCompression compression,bool resetValues)
compression
JPEG Compression data to be set
resetValues
Indicates the JPEG compression values to set
Depending upon the flag used, this method will either set JPEG compression options for the current TWAIN session, or restore the default JPEG compression options for the current TWAIN session. For more information, refer to Using JPEG Compression For A TWAIN Source.
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();}
Imports LeadtoolsImports Leadtools.TwainPublic Sub SetJpegCompressionExample(ByVal parent As IntPtr)Dim session As TwainSession = New TwainSession()session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)TryDim myJpeg As TwainJpegCompression = session.GetJpegCompression(False)Dim data As TwainMemoryData() = New TwainMemoryData(0) {}myJpeg.ColorScheme = TwainColorScheme.GraymyJpeg.SubSampling = &H10001000myJpeg.ColorComponentCount = 1myJpeg.RestartFrequency = 0Dim quantMap As Integer() = New Integer(0) {}quantMap(0) = 0myJpeg.SetQuantizationMap(quantMap)Dim haffmanMap As Integer() = New Integer(0) {}haffmanMap(0) = 0myJpeg.SetHuffmanMap(haffmanMap)myJpeg.SetQuantizationTable(data)myJpeg.SetHuffmanDC(data)myJpeg.SetHuffmanAC(data)session.SetJpegCompression(myJpeg, False)MessageBox.Show("Set JPEG compression options is success")Catch ex As ExceptionMessageBox.Show(ex.Message)End Trysession.Shutdown()End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
