This project has moved. For the latest updates, please go here.

VB Sample2 with Epson Perfection V550 Scanner

Sep 22, 2014 at 7:36 PM
I just found your project and I am hoping to use it on a project of mine whdree I am trying to control an Epson Perfection V550 scanner

At this point, I am just working with one of the samples but have a couple of questions wrt to the scanner resolution. The Epson V550 is capable of many scanning resolutions. Of particula interest to me are 150, 300, 600 and 1200dpi.

In VB Sample2, those resolutions are not listed as the list of resolutions is greatere than 20 (so it is not listed). If I look at the variable that received the accepted resolutions, the list stops at 1183. It most go much higher.

I took a stab a setting the resolution at 1200 directy (before the call to acquire) but the application complained that the "Capability has dependancy on an other capability".

I am probably just missing something obvious and will continue to try to use Saraff.Twain.
Thanks for any comments.
Ian
Coordinator
Sep 22, 2014 at 8:40 PM
Hello, ijourneaux.
See documentation of Saraff.Twain.NET and TWAIN 2.3 Specification.
ICAP_XRESOLUTION and ICAP_YRESOLUTION capabilities can be set to any value supported by the data source.
ICAP_XRESOLUTION
Description
All the X-axis resolutions the Source can provide.
Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS yields
dimensionless data). That is, when the units are TWUN_PIXELS, both ICAP_XRESOLUTION and
ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources like to report the actual
number of pixels that the device reports, but that response is more appropriate in
ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH.
Application
Setting this value will restrict the various resolutions that will be available to the user during
acquisition.
Applications will want to ensure that the values set for this ICAP match those set for
ICAP_YRESOLUTION.
[TWAIN 2.2 Specification. 10-199]
ICAP_YRESOLUTION
Description
All the Y-axis resolutions the Source can provide.
Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS yields
dimensionless data). That is, when the units are TWUN_PIXELS, both ICAP_XRESOLUTION and
ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources like to report the actual
number of pixels that the device reports, but that response is more appropriate in
ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH.
Application
Setting this value will restrict the various resolutions that will be available to the user during
acquisition.
Applications will want to ensure that the values set for this ICAP match those set for
ICAP_XRESOLUTION.
[TWAIN 2.2 Specification. 10-202]
Sep 23, 2014 at 2:54 PM
Dug into this alittle more
The call to
        Dim _resolutions = Me._twain32.Capabilities.XResolution.Get()
on the Epson Perfection V550 This returns a _resolution.Count of 1134 with resolutions from 50 to 1183. I am trying to set a dpi of 1200 which isn't in the list. From the Epson Scan utility, the scanner is capable of resolutions from 50-12800 with about 20 different choices.
Coordinator
Sep 23, 2014 at 3:11 PM
Hello, ijourneaux.
This is not a bug. The Twain32.Capabilities.XResolution.Get() method returns a list of values ​​supported by the current the data source in now time. Therefore the resolution should be in the range of values ​​returned by the Twain32.Capabilities.XResolution.Get() method.
Sep 23, 2014 at 3:18 PM
Thank you for the quick reply. I wan't implying that there was a bug. What I am trying to understand is why the resolutions 1200, 2400, 3200, 4800, 6400, 9600 and 12800 that I know the scanner is capable of, are not in the list of resolutions returned by _twain32.Capabilities.XResolution.Get().
Coordinator
Sep 23, 2014 at 4:01 PM
To answer this question necessary to refer to the documentation of a scanner or client support service.
Sep 23, 2014 at 5:51 PM
I have asked Epson for some assistance and more detailed information on the TWAIN interface. Interestingly the older Epson Perfection 4490 seems to work
Oct 2, 2014 at 3:29 AM
So far Epson hasn't been much help. I have confirmed that the same problem occurs with NTwain. The call to the get method returns a list of 1134 entries from 50 to 1184.
So 1200 is not in the list of acceptable choices.
I realize this is not you problem but do you have any thoughts on how I might be able to set a dpi of 1200? Any possibility that the get only returns a subset?
Coordinator
Oct 2, 2014 at 6:13 PM
Hello, ijourneaux.
I think that should be rounded values​​. For example:

C#
this.resolutionToolStripDropDownButton.DropDownItems.Clear();
Twain32.Enumeration _resolutions=this._twain32.Capabilities.XResolution.Get();
if(_resolutions.Count<20) {
    for(int i=0; i<_resolutions.Count; i++) {
        this.resolutionToolStripDropDownButton.DropDownItems.Add(
            string.Format("{0:N0} dpi",_resolutions[i]),
            null,
            _ResolutionItemSelected).Tag=_resolutions[i];
    }
    this._ResolutionItemSelected(this.resolutionToolStripDropDownButton.DropDownItems[_resolutions.CurrentIndex],new EventArgs());
} else {
    foreach(var _val in new float[] { 100f,200f,300f,600f,1200f,2400f }) {
        for(int i=_resolutions.Count-1; i>=0; i--) {
            if(Math.Abs((float)_resolutions[i]-_val)<50f) {
                var _item=this.resolutionToolStripDropDownButton.DropDownItems.Add(
                    string.Format("{0:N0} dpi",_val),
                    null,
                    _ResolutionItemSelected);
                _item.Tag=_resolutions[i];
                if(i==_resolutions.CurrentIndex) {
                    this._ResolutionItemSelected(_item,new EventArgs());
                }
                break;
            }
        }
    }
}
VB.NET
Me.resolutionToolStripDropDownButton.DropDownItems.Clear()
Dim _resolutions As Twain32.Enumeration = Me._twain32.Capabilities.XResolution.[Get]()
If _resolutions.Count < 20 Then
    For i As Integer = 0 To _resolutions.Count - 1
        Me.resolutionToolStripDropDownButton.DropDownItems.Add(String.Format("{0:N0} dpi", _resolutions(i)), Nothing, _ResolutionItemSelected).Tag = _resolutions(i)
    Next
    Me._ResolutionItemSelected(Me.resolutionToolStripDropDownButton.DropDownItems(_resolutions.CurrentIndex), New EventArgs())
Else
    For Each _val As var In New Single() {100F, 200F, 300F, 600F, 1200F, 2400F}
        For i As Integer = _resolutions.Count - 1 To 0 Step -1
            If Math.Abs(CSng(_resolutions(i)) - _val) < 50F Then
                Dim _item = Me.resolutionToolStripDropDownButton.DropDownItems.Add(String.Format("{0:N0} dpi", _val), Nothing, _ResolutionItemSelected)
                _item.Tag = _resolutions(i)
                If i = _resolutions.CurrentIndex Then
                    Me._ResolutionItemSelected(_item, New EventArgs())
                End If
                Exit For
            End If
        Next
    Next
End If
Marked as answer by SARAFF on 10/13/2014 at 12:48 PM