I'd recommend taking a glance at the SimpleScan project ( https://github.com/mnagel/simple-scan) to get a feel for how commonplace options are handled.
Cheers, matb On 25 Jun 2015 5:02 am, "Leon Hauck" <[email protected]> wrote: > I'm writing a custom frontend for a scanning project in C++ and am about > 80% complete. I've been able to get this far by reviewing the scanimage > and test code included in the source and whatever examples I found on the > web. Hopefully someone can nudge me in the right direction. > > Sane, scanimage, and xsane are configured and running properly on my test > system (using an Epson Perfection 636 and a Canon LIDE220). > > In my frontend I've got the device selected and opened and can make > repeated scans, however the images I'm saving (in PNM format) aren't what > I'm expecting. I'm pretty sure it's due to not setting some of the options > properly prior to the scan. > > So my question is - what settings to I need to set to prior to doing a > scan to: > > - set the mode (color or gray) > - set the bit depth of the scan (to largest supported by scanner) > - set the scan area > (all scans for this application are going to be > for a fixed area) > > Are there some straight forward examples on how to set these options? I've > looked through the scanimage.c code and can't track down exactly where it > handles the "--mode Color" command line option. > > The code I'm (unsuccessfully) using now to (attempt to) set these during > program startup is below: > > > // ---------------------------------------------------------- > // taken from epson sane driver > #define OPT_RESOLUTION 10 > #define OPT_TL_X 25 > #define OPT_TL_Y 26 > #define OPT_BR_X 27 > #define OPT_BR_Y 28 > #define OPT_MODE 2 > #define OPT_BIT_DEPTH 3 > > // set photo option > SANE_Int saneIntVal; > > saneIntVal = 300; > sane_control_option( sHand , OPT_RESOLUTION , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > saneIntVal = 8; > sane_control_option( sHand , OPT_BIT_DEPTH , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > saneIntVal = 1; > sane_control_option( sHand , OPT_MODE , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > saneIntVal = 0; > sane_control_option( sHand , OPT_TL_X , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > saneIntVal = 0; > sane_control_option( sHand , OPT_TL_Y , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > saneIntVal = 200; > sane_control_option( sHand , OPT_BR_X , > SANE_ACTION_SET_VALUE , & saneIntVal , &sane_info ); > > saneIntVal = 200; > sane_control_option( sHand , OPT_BR_Y , > SANE_ACTION_SET_VALUE , &saneIntVal , &sane_info ); > > > // ---------------------------------------------------------- > > > Thanks in advance - any help would be appreciated. > > -- > sane-devel mailing list: [email protected] > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel > Unsubscribe: Send mail with subject "unsubscribe your_password" > to [email protected] >
-- sane-devel mailing list: [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to [email protected]
