Pyinsane 1.3.4 修复了对 Python 3 和 ADF (Automatic Document Feeder) 支持的 bug。
Pyinsane 是 Sane API (使用ctypes) 和抽象层的纯 Python 实现。支持 Python 2.7 和 3.x,要求 Pillow 和 libsane 支持。
实现简单扫描的代码:
device.options['resolution'].value = 300
# Beware: Some scanner have "Lineart" or "Gray" as default mode
device.options['mode'].value = 'Color'
scan_instance = device.scan(multiple=False)
try:
while True:
scan_instance.read()
except EOFError:
pass
image = scan_instance.get_img()
Pyinsane 的下载地址:请点这里