python调用扫描仪设备_在Python中使用Twain模块

在64位Windows和Python环境下,使用Twain模块连接扫描仪时遇到空窗口问题。解决方案涉及到32位和64位驱动的路径问题。DSM(数据源管理器)的32位版本查找twain_32文件夹中的驱动,而64位版本查找twain_64文件夹。确保安装的驱动与DSM匹配,可以使用Dependency Walker工具来检查依赖项。
摘要由CSDN通过智能技术生成

I have 64 bit Windows and 64 bit Python . In the twain docs said : supports only 32 bit . I have used twain data source to install my 64 bit machine and used this code to connect scanner device:

import twain

sm = twain.SourceManager(0)

ss = sm.OpenSource()

ss.RequestAcquire(0,0)

rv = ss.XferImageNatively()

if rv:

(handle, count) = rv

twain.DIBToBMFile(handle, 'image.bmp')

When I run the app. a windows opens like :

so why this window is empty . The scanner device will show in this window ?

解决方案

The driver files for a 32 bit driver will be placed twain_32 folder and 64 bit driver files under the twain_64 folder. The twain DSM which searches for the drivers available has two versions 32 and 64 bit. The 32 bit version of the DSM looks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值