I’ve got a task I’m working on that involves repeated scanning via GIMP, and I’m stuck on a Windows box to do it.
I get the best results in GIMP when I scan via the scanner’s TWAIN driver. All works well when I go through the menus to acquire via TWAIN.
I would like to automate this task (at least partially) via Python-Fu. However, I cannot figure out how to call the “twain-acquire” function via Python-Fu.
The “Browse…” dialog describes the function as taking a single argument, with that argument being “The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }”. It also indicates that the function returns two items, the first being the image count and the second being the IDs of the images.
It seems like it should be straight-forward to call this function, but I apparently do not know how to do so without generating an error. Calling it with a 0 or 1 argument generates an error:
>>> image_count, image_ids = pdb.twain_acquire(0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: calling error
>>> image_count, image_ids = pdb.twain_acquire(1)
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: calling error
And calling it with no argument generates the same error:
>>> image_count, image_ids = pdb.twain_acquire()
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: calling error
Can anyone kindly provide an example of how to use the twain-acquire function from Python-Fu? Or, more generally, how to invoke a TWAIN scan from Python-Fu?
Thanks!