gb.scanner how to set resolution

Post

Posted
Rating:
#1 (In Topic #1867)
Regular
bill-lancaster is in the usergroup ‘Regular’
I'm using gb.scanner and can scan items OK
How can I set the scanner resoltion?
I see that it is contained in the ScannerOption class.  How do I access the properties of that class?
Any help would be appreciated
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘unknown’
cogier is in the usergroup ‘GambOS Contributor’
I found some old code that I have modified. It will show you a list of all the available 'Resolutions' and then scan at 300. My scanner allows a resolution of up to 600, but Gambas won't get the image at that resolution, I have no idea why.
Run this code in a new Graphical Application

' Gambas class file

''NEEDS THE 'gb.scanner' COMPONENT

Private PictureBox1 As PictureBox


Public Sub Form_Open()

  Dim sName As String
  Dim hScanners As New Scanners
  Dim hScanner As Scanner
  Dim aScanners As New String[]
  Dim imgScan As Image
  Dim sList As New String[]
  Dim iLoop As Integer

  BuildForm

  hScanners.Search(True)

  For Each sName In hScanners
    aScanners.Add(sname)
  Next

  hScanner = New Scanner(aScanners[0])

  sList = hScanner.Find("Resolution").List

  For iLoop = 0 To sList.Max
    Print sList
  [iLoop]Next

  hScanner.Find("Mode").Value = "Color"
  hScanner.Find("Resolution").Value = "300"

  imgScan = hScanner.Scan()

  PictureBox1.Picture = imgScan.Picture

End

Public Sub BuildForm()

  With Me
    .Arrangement = Arrange.Vertical
    .Padding = 5
    .Maximized = True
  End With

  With PictureBox1 = New PictureBox(Me) As "PictureBox1"
    .Expand = True
    .Alignment = Align.Center
    .Mode = PictureBox.Contain
  End With

End


 
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by Yogi)
#3
Avatar
Enthusiast
Gianluigi is in the usergroup ‘Enthusiast’
Gianluigi is in the usergroup ‘GambOS Contributor’
Hi
It is easier to use the attached frontend which is a copy and paste of Fabien Bodard's component.
 :goodbye:

Attachment

ScannerTest-3.21.99.tar.gz

scanner.jpg
Online now: No Back to the top
1 guest and 0 members have just viewed this.