LEADTOOLS Support
Imaging
Imaging SDK Questions
How to change Quality Factor when scanning AcquireMulti() method?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, March 13, 2006 6:14:14 PM(UTC)
Groups: Registered
Posts: 6
Hi
Does anyone know how to set the Quality Factor of the JPEG file when scanning using AcquireMulti() method?
See the code below:
Private Sub RasterTwain_AcquireMultiEvent(ByVal nPage As Integer, ByVal bstrFileName As String, ByVal bFinishScan As Boolean)
Dim strMsg As String
If bFinishScan Then
strMsg = "The page # " + CStr(nPage) + " is scanned and saved to file name " + bstrFileName
MsgBox strMsg
End If
End Sub
Private Sub Command1_Click()
Dim nRet As Integer
RasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
RasterTwain.FastFormat = FILE_JPEG
RasterTwain.FastBitsPerPixel = 24
RasterTwain.FastBufferSize = 0
RasterTwain.FastUsePreferredBufferSize = True
RasterTwain.EnableAcquireMultiEvent = True
RasterTwain.XResolution = 150
RasterTwain.YResolution = 150
' How to change the Quality factor ???
nRet = RasterTwain.AcquireMulti("C:\IMAGES\MULIMG.JPG", 0, True)
If nRet = 0 Then
MsgBox "The Fast Twain method was successful", vbOKOnly, "Notice"
Else
MsgBox "Error occurred during the fast Twain method!!!", vbOKOnly, "Error!!!"
End If
End Sub
#2
Posted
:
Tuesday, March 14, 2006 5:30:23 AM(UTC)
Groups: Registered
Posts: 8
The only way I know how to do this is by loading the image into the Lead main control or raster view control in the AcquireMultiEvent then saving it with the desired quality.
This example uses the Lead Main Control, but you can do something similar with the Lead Raster View control and LeadRasteIO
You have to look at the boolean bFinishScan becuase this event is fired twice for each page scanned.
Note from Leads help file: you can also use a factor of 0 to produce lossless JPEG files
Private Sub RasterTwain_AcquireMultiEvent(ByVal nPage As Integer, ByVal bstrFileName As String, ByVal bFinishScan As Boolean)
If bstrFileName <> vbNullString And bFinishScan Then
intRet = mvarLdImage.Load(bstrFileName, 24, 0, 1)
mvarLdImage.Save bstrFileName, FILE_JPEG, 24, 0, SAVE_OVERWRITE
End If
End Sub
#3
Posted
:
Wednesday, March 15, 2006 6:54:55 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Thank you ewintermyer for your contribution. Your suggestion should
works with any type of Twain driver, but it doesn't make use of the
scanner's compression abilities if it has them.
For a Twain source with inbuilt JPEG scanning, you could use the
ICAP_JPEGQUALITY capability (if it's supported) to control the quality
level. The Twain Specification states the allowed values for this
capability.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
Imaging
Imaging SDK Questions
How to change Quality Factor when scanning AcquireMulti() method?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.