本文介绍了在Python中使用Twain模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有64位Windows和64位Python.在 twain文档中说:仅支持32位.我已使用 twain数据源安装我的64位计算机,并使用此代码连接了扫描仪设备:

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 ?

推荐答案

32位驱动程序的驱动程序文件将放置在twain_32文件夹中,而64位驱动程序文件将放置在twain_64文件夹下.用于搜索可用驱动程序的twain DSM具有两个版本32和64位. DSM的32位版本在twain_32文件夹中查找驱动程序,在该文件夹的64位版本下查找64位版本.因此,您似乎需要检查安装了哪个版本的驱动程序(32/64位).依赖行者将帮助您快速解决此问题.有关依赖关系的更多详细信息-请参阅第12章- https://www.twain.org/wp-content/uploads/2016/03/TWAIN-2.2-Spec.pdf

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 for the drivers in the twain_32 folder and 64 bit version under the 64 bit version of the folder. Hence, it looks like you need to check which version of the driver is installed (32/64 bit).Dependency walker will help you quickly resolve this issue.More details on dependencies - Refer to chapter 12 - https://www.twain.org/wp-content/uploads/2016/03/TWAIN-2.2-Spec.pdf

这篇关于在Python中使用Twain模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 12:28