python-twain library in duplex mode get separate image from each side -


i trying scan using python-twain library in duplex mode , 2 images 1 each side.

import twain sm = twain.sourcemanager(0) ss = sm.opensource('plustek mobileoffice d600')  ss.setcapability( twain.cap_duplexenabled, twain.twty_bool, true ) ss.requestacquire(0,0) rv = ss.xferimagenatively() if rv:     (handle, count) = rv     twain.dibtobmfile(handle, 'image.bmp')  

the code 1 image library documentation provided @ http://twainmodule.sourceforge.net/ , don't see how take independently images it. know possible because in demo close source library clscan(http://www.commandlinescanning.com).

any suggestions welcome.

i found sample code twainbackend.py on github. can use loop save available images:

import twain  index = 0;  def next(ss):     try:         print ss.getimageinfo()         return true     except:         return false  def capture(ss):     global index     rv = ss.xferimagenatively()     filename = str(index) + '_image.bmp';     index+=1;     print rv;     if rv:         (handle, count) = rv         twain.dibtobmfile(handle, filename)   sm = twain.sourcemanager(0) ss = sm.opensource('plustek mobileoffice d600')  try:         ss.setcapability( twain.cap_duplexenabled, twain.twty_bool, true) except:     print "could not set duplex true"  print "acquire image" ss.requestacquire(0,0)  while next(ss):     capture(ss)  print('done') 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -