WIA扫描仪,无法获取/设置4104和6146属性(颜色,颜色深度)

时间:2013-11-06 14:12:52

标签: c# .net wia

我正在尝试使用WIA在C#项目中配置柯达i2600扫描仪的颜色和深度。几个帖子引用参数6146(可以取值1(颜色),2(灰度)或4(白色和黑色))和4104(颜色深度= 24)。

WIA Automation for scanner color intent is not working

Windows image acquisition - setting device properties in C#

Detect all available scanner resolutions using WIA

当我迭代阵列扫描器属性​​时,不会出现这些属性。

我使用foreach循环来迭代属性,这是我得到的列表:

  • 3112:用户名:*******
  • 4098:商品名称:Root
  • 4099:完整项目名称:0000 \ Root
  • 4101:项目标志:76
  • 2:唯一设备ID:{613DD1FC6 - 810E- 1100 - 13EC7- 0800213E2092F} \ 0000
  • 3:制造商:Kodak
  • 4:说明:柯达i2600型扫描仪
  • 5:输入:65537
  • 6:端口:\ AUsbscan0
  • 7:名称:柯达i2600型扫描仪
  • 8:服务器:本地
  • 9:远程设备ID:
  • 10:Ul Class ID:{40131AD10 - 3391 - 11D2-9A33- 00C04FA36145}
  • 11:硬件配置:0
  • 12:8audRate:
  • 13:STI通用能力:49
  • 14:WIA版本:2.0
  • 15:驱动程序版本:1.1.0.0
  • 16:的PnP ID字符串:USB = VID 040A&安培; PID 601D = 0000000000000000 = {6bddlfc6- 810f- 11d0- bec7- 0800 2be2092f}
  • 17:STI驱动程序版本:3
  • 4125:项目类别:{F193526F-5988- 4A26- 9888-E16E4F97CE10}
  • 1026:固件版本:0
  • 3086:文件处理能力:8229
  • 3087:文件处理状态:5
  • 3095:最长扫描时间:3600000
  • 3090:水平光学分辨率:600
  • 3091:垂直光学分辨率:600
  • 3103:显示预览控件:0
  • 3098:页面宽度:8500
  • 3099:Page Height:14000
  • 3096:页数:0
  • 3076:水平进纸尺寸:8500
  • 3077:垂直送纸尺寸:14000
  • 3088:文件处理选择:1
  • 3078:送纸器注册:1
  • 3104:最小水平进纸尺寸:1000
  • 3105:最小垂直送纸尺寸:1000
  • 3100:预览:0

扫描仪驱动程序已更新。

1 个答案:

答案 0 :(得分:3)

我遇到了同样的问题(柯达i2400)。

如果你愿意,试试这个:

WIA.Item item = device.Items[1] as WIA.Item;

AdjustScannerSettings(item, 150, 0, 0, 1250, 1700, 0, 0, 1);


private static void AdjustScannerSettings(IItem scannnerItem, int scanResolutionDPI, int scanStartLeftPixel, int scanStartTopPixel,
        int scanWidthPixels, int scanHeightPixels, int brightnessPercents, int contrastPercents, int colorMode)
{
    const string WIA_SCAN_COLOR_MODE = "6146";
    const string WIA_HORIZONTAL_SCAN_RESOLUTION_DPI = "6147";
    const string WIA_VERTICAL_SCAN_RESOLUTION_DPI = "6148";
    const string WIA_HORIZONTAL_SCAN_START_PIXEL = "6149";
    const string WIA_VERTICAL_SCAN_START_PIXEL = "6150";
    const string WIA_HORIZONTAL_SCAN_SIZE_PIXELS = "6151";
    const string WIA_VERTICAL_SCAN_SIZE_PIXELS = "6152";
    const string WIA_SCAN_BRIGHTNESS_PERCENTS = "6154";
    const string WIA_SCAN_CONTRAST_PERCENTS = "6155";

    SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_RESOLUTION_DPI, scanResolutionDPI);
    SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_RESOLUTION_DPI, scanResolutionDPI);
    SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_START_PIXEL, scanStartLeftPixel);
    SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_START_PIXEL, scanStartTopPixel);
    SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_SIZE_PIXELS, scanWidthPixels);
    SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_SIZE_PIXELS, scanHeightPixels);
    SetWIAProperty(scannnerItem.Properties, WIA_SCAN_BRIGHTNESS_PERCENTS, brightnessPercents);
    SetWIAProperty(scannnerItem.Properties, WIA_SCAN_CONTRAST_PERCENTS, contrastPercents);
    SetWIAProperty(scannnerItem.Properties, WIA_SCAN_COLOR_MODE, colorMode);
}

private static void SetWIAProperty(IProperties properties, object propName, object propValue)
{
    Property prop = properties.get_Item(ref propName);
    prop.set_Value(ref propValue);
}