如何查看扫描仪支持的图像格式?
我想通过 TWAIN 接口获取扫描仪支持的文件格式。有一个示例如何获取支持的格式:
GetCapability(ICAP_IMAGEFILEFORMAT, unTest);
CString strType;
strType.Format("Type Supported %d\n", unTest);
但是我猜想这里有问题,因为 ICAP_IMAGEFILEFORMAT 成员不是位掩码:
#define TWFF_TIFF 0 /* Tagged Image File Format */
#define TWFF_PICT 1 /* Macintosh PICT */
#define TWFF_BMP 2 /* Windows Bitmap */
#define TWFF_XBM 3
#define TWFF_JFIF 4 /* JPEG File Interchange Format */
#define TWFF_FPX 5 /* Flash Pix */
...
所以如果扫描仪支持 TIFF、PICT、BMP 和JFIF 不可能在一次调用中返回这样的信息。
如何获取扫描仪支持的格式列表?
I would like to get file formats supported by scanner via TWAIN interface. There is an example how to get supported formats:
GetCapability(ICAP_IMAGEFILEFORMAT, unTest);
CString strType;
strType.Format("Type Supported %d\n", unTest);
But I guess there is something wrong here because ICAP_IMAGEFILEFORMAT members not a bit masks:
#define TWFF_TIFF 0 /* Tagged Image File Format */
#define TWFF_PICT 1 /* Macintosh PICT */
#define TWFF_BMP 2 /* Windows Bitmap */
#define TWFF_XBM 3
#define TWFF_JFIF 4 /* JPEG File Interchange Format */
#define TWFF_FPX 5 /* Flash Pix */
...
So if scanner supports TIFF, PICT, BMP & JFIF it's impossible to return such informartion within one call.
How can I get list of supported formats by scanner?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您必须查询DS(例如尝试设置您想要的值)以查看您想要的格式是否受支持,然后根据结果您可以构建列表或支持的格式。我认为这就是 msgget 容器的方式,
TW_ONEVALUE - 单个值,其当前值和默认值是
一致的。该类型的可用值范围
能力就是这个单一的值。例如,一个
指示文档存在的能力
馈线可以是这种类型。
规范的 ICAP_IMAGEFILEFORMAT 部分的描述似乎暗示您只能设置为单个值,或返回单个值:
应用程序
使用此 ICAP 来确定可用于文件传输的格式,并设置上下文
其他能力协商,例如 ICAP_COMPRESSION。
请务必使用 DG_CONTROL / DAT_SETUPFILEXFER / MSG_SET 操作来指定
用于特定采集的格式。
源
如果不支持,则返回 TWRC_FAILURE / TWCC_CAPUNSUPPORTED。
如果不支持操作,则返回TWRC_FAILURE、TWCC_CAPBADOPERATION。 (看
DG_CONTROL /DAT_CAPABILITY/ MSG_QUERYSUPPORT)
无论如何,我可能会误解,但这就是我的感觉。
I believe you'll have to query the DS (e.g. try setting the value you want) to see if the format you want is supported, then based on results you could build the list or supported formats. I think this is the way as the msgget container is,
TW_ONEVALUE -- A single value whose current and default values are
coincident. The range of available values for this type of
capability is simply this single value. For example, a
capability that indicates the presence of a document
feeder could be of this type.
and the description from ICAP_IMAGEFILEFORMAT section of the spec seems to imply that you'd only be able to set to a single value, or get back a single value:
Application
Use this ICAP to determine which formats are available for file transfers, and set the context for
other capability negotiations such as ICAP_COMPRESSION.
Be sure to use the DG_CONTROL / DAT_SETUPFILEXFER / MSG_SET operation to specify the
format to be used for a particular acquisition.
Source
If not supported, return TWRC_FAILURE / TWCC_CAPUNSUPPORTED.
If Operation is not supported, return TWRC_FAILURE, TWCC_CAPBADOPERATION. (See
DG_CONTROL /DAT_CAPABILITY/ MSG_QUERYSUPPORT)
Anyway, I could be mis-interpreting, but that's what it seems like to me.
我认为在一次调用中获取所有支持的文件格式是可行的,因为“Container for MSG_GET”和“Container for MSG_SET”都支持 TW_ENUMERATION。
I think getting all the supported file formats in one call is doable, since both "Container for MSG_GET" and "Container for MSG_SET" support TW_ENUMERATION.