SetJPEGCompression Example for Visual Basic

Dim RasterTwain As New LEADRasterTwain_U
RasterTwain.InitSession hWnd
RasterTwain.SelectSource

Dim nRet As Integer
nRet = RasterTwain.GetJPEGCompression(L_LTWAIN_GET_JPEG_COMPRESSION)
If nRet = 0 Then
	RasterTwain.JPEGCompressionData.ColorSpace = L_TWPT_GRAY
	RasterTwain.JPEGCompressionData.SubSampling = &H10001000
	RasterTwain.JPEGCompressionData.NumComponents = 1
	RasterTwain.JPEGCompressionData.RestartFrequency = 0
	RasterTwain.JPEGCompressionData.QuantMap(0) = 0
	RasterTwain.JPEGCompressionData.HuffmanMap(0) = 0

	nRet = RasterTwain.SetJPEGCompression(L_LTWAIN_SET_JPEG_COMPRESSION)
	If nRet = 0 Then
		MsgBox "Set JPEG compression options is success"
	End If
End If