TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Tue May 22, 2012 2:06 am




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Resolution Problem
PostPosted: Sat Jul 05, 2008 6:49 pm 
Offline

Joined: Sat Jul 05, 2008 6:35 pm
Posts: 5
I an trying to scan a B/W page and VB6 code is as follows:

Twain.OpenSource
Twain.TransferMode = TWSX_NATIVE
Twain.Resolution = 300
Twain.TIFFCompressionType = TIFF_NONE
Twain.PixelType = 0
Twain.BitDepth = 1
Twain.IfThrowException = True
Twain.IfShowUI = False
Twain.EnableSource
.
.
.


Private Sub Twain_OnPostTransfer()

Twain.CloseSource
Dim strFile As String
strFile = App.Path & "\scan.tiff"
If (Twain.SaveAsTIFF(strFile)) Then
else
'error message
endif
.
.
.
The image is scanned and saved successfully, however, the resolution of the image in file is only 96 DPI instead of 300 DPI.

Any idea as to why the resolution is not 300DPI ?

Thanks for your help
Ralph


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 06, 2008 7:03 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
The code should be OK. Please make sure that the driver of your scanner really supports the resolution you set.

You can try adding the following line after the AcquireImage method to check the resolution you set to the image:
====================
MsgBox (Twain.Resolution)
====================

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 07, 2008 12:55 pm 
Offline

Joined: Sat Jul 05, 2008 6:35 pm
Posts: 5
The driver does support the 300 DPI resolution. I see that as one of the available resolution choices in the scanner GUI. Also I have other applications that use the scanner and they can successfully scan at 300 DPI and save the file as 300 DPI.

I added the

MsgBox (Twain.Resolution)

as you requested and I recevied the message box conatining '300'.

It appears that the Twain.SaveAsTIFF function is not saving at 300 DPI but instead converting to 96 DPI. Any ideas as to why?

Thanks
Ralph


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 07, 2008 10:48 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Please try using the following code to see if it works.
===============================
Private Sub Command1_Click()
twain.OpenSource
twain.TransferMode = TWSX_NATIVE
twain.Resolution = 300
MsgBox twain.Resolution
twain.TIFFCompressionType = TIFF_NONE
twain.IfDisableSourceAfterAcquire = True
twain.PixelType = 0
twain.BitDepth = 1
twain.IfShowUI = False
twain.EnableSource
End Sub

Private Sub Command2_Click()
twain.SaveAsTIFF "C:\test.tiff", 0
End Sub

Private Sub twain_OnPostTransfer()
MsgBox twain.ImageXResolution
MsgBox twain.ImageYResolution
End Sub
===============================

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 08, 2008 5:42 am 
Offline

Joined: Sat Jul 05, 2008 6:35 pm
Posts: 5
I had to make the following change:

Private Sub Command2_Click()
twain.SaveAsTIFF "C:\test.tiff"
End Sub

to remove the additional parameter. Only the filename was accepted for the .SaveAsTIFF function.

With that change, all three message boxes displayed '300' however, the file was saved with 96 DPI.

Why is the save function saving at 96 DPI ?

Thanks
Ralph


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 08, 2008 9:46 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
I have not met this problem before. Would you please try saving the image as BMP to see if it works?

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 09, 2008 3:19 am 
Offline

Joined: Sat Jul 05, 2008 6:35 pm
Posts: 5
The image is successfully saved as a BMP however, the resolution is still 96 DPI.

Do you have any ideas what would cause the file to be saved at 96 DPI regardless of TIFF or BMP format?

Thanks
Ralph


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 09, 2008 7:05 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Would you please send your whole file, as well as the BMP/TIFF files you saved to our support team at twainsupport@dynamsoft.com? Our support team will check the code for you.

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 14, 2008 5:42 pm 
Offline

Joined: Sat Jul 05, 2008 6:35 pm
Posts: 5
I borrowed another scanner and ran my code using the borrowed scanner. The saved TIFF file was 300 DPI.

It appears that the problem was somehow related to my original scanner and/or scanner driver.

Thanks for all your help!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 14, 2008 9:32 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
:) You are welcome.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

It is currently Tue May 22, 2012 2:06 am


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog