I want to connect my program to image scanner

Six years have passed and I came here today looking for the answer to the same question.

Pysane and python-imagescanner in the currently accepted answer are unfortunately no longer active, but after som further searching I found libinsane which seems to be a better option nowadays.

In Windows, the module you will want to look into is called the Python TWAIN module, while in Linux (and I think Mac) you should look into pysane.

Now that I am digging into this it looks like there is a project called python-imagescanner that tries to wrap these two approaches into a common library,

From imagescanner's documentation

Getting access to a scanner device:

 from imagescanner import ImageScanner

 # instantiate the imagescanner obj 
 iscanner = ImageScanner()

 # get all available devices
 scanners = iscanner.list_scanners()

 # choose one of the devices
 scanner = scanners[0]

 # scan your file (returns a PIL object)