TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

ICAP_BRIGHTNESS setting is ignored (?)

Forums › TWAIN Classic › ICAP_BRIGHTNESS setting is ignored (?)

  • This topic has 14 replies, 5 voices, and was last updated 10 years, 12 months ago by fortunece.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • April 21, 2008 at 12:36 pm #22319 Reply
    Zoltan Barna
    Participant
    • Topics - 1
    • Replies - 4
    • Total Posts - 5

    Hi!
    I have a problem with setting of brightness.
    I set brightness to the user selected value (-1000 to 1000) then I ask it (MSG_GET).
    The response of the scanner is the desired value but the brightness of the
    image is always the same (default value).
    If I use the user interface the setting is correct.
    Thx:

    April 21, 2008 at 1:26 pm #24457 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    what model? does your code work on other devices?

    .

    April 22, 2008 at 8:31 am #24458 Reply
    Zoltan Barna
    Participant
    • Topics - 1
    • Replies - 4
    • Total Posts - 5

    Dear gabe!

    The model is a HP ScanJet 5590P scanner.
    I have not tried with other scanners, yet but I think it does not matter, because I can make the settings using the UI.

    Thanks!

    @gabe wrote:

    what model? does your code work on other devices?

    .

    April 22, 2008 at 8:35 am #24459 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.

    the commercial drivers have historically played nicer than the standard ones that get installed.

    .

    April 22, 2008 at 8:45 am #24460 Reply
    Zoltan Barna
    Participant
    • Topics - 1
    • Replies - 4
    • Total Posts - 5

    Ok, I will try it.
    Maybe the driver can do anything that we can not do by programming twain interface? Or it is a bug?

    @gabe wrote:

    what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.

    the commercial drivers have historically played nicer than the standard ones that get installed.

    .

    April 22, 2008 at 9:13 am #24461 Reply
    Zoltan Barna
    Participant
    • Topics - 1
    • Replies - 4
    • Total Posts - 5

    I have installed the Commercial driver.
    Brightness capability range is the following:
    Min = 256
    Max = 111
    Step = 127
    Current = -992
    Default = -1000

    @Zoltan Barna wrote:

    Ok, I will try it.
    Maybe the driver can do anything that we can not do by programming twain interface? Or it is a bug?

    @gabe wrote:

    what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.

    the commercial drivers have historically played nicer than the standard ones that get installed.

    .

    April 23, 2008 at 1:47 pm #24462 Reply
    Zoltan Barna
    Participant
    • Topics - 1
    • Replies - 4
    • Total Posts - 5

    Gabe!

    The commercial driver is OK!
    The return value of MSG_GET was TWON_ENUMERATION (I expected TWON_RANGE because of the WIA driver).
    But, I do not still know how the User Interface sets brightness and contrast.
    Any idea?

    Thanks!

    April 25, 2008 at 6:05 am #24463 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    this is where one of my favorite capabilities gets involved. that ‘commercial’ driver probably also supports a capability named enableDsUiOnly. the interesting thing here is that if you call EnableDsUiOnly then the vendor Ui will come up – just like with the standard EnableDs call. But when you ‘ok’ the ui you can call CustomDsData.Get and you’ll recieve the (almost) all of the settings in that will later look a lot like an ini file format. From there you can play around with thier Ui and see what values the Ui is using.

    if this didn’t make sense post back and I’ll try to explain it better.

    .

    January 20, 2010 at 6:59 am #24464 Reply
    fortunece
    Participant
    • Topics - 0
    • Replies - 5
    • Total Posts - 5

    Our program need to disable the default UI. so we do the following code.
    set the capability,
    TwCapability capBrightness = new TwCapability(TwCap.ICAP_BRIGHTNESS, 100, TwType.Fix32);
    rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capBrightness);
    if (rc != TwRC.Success)
    {
    CloseSrc();
    return;
    }
    get the capability.
    TwCapability capbright = new TwCapability(TwCap.ICAP_BRIGHTNESS, TwOn.Range, TwType.Fix32, -1);
    rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capbright);
    if (rc != TwRC.Success)
    {
    CloseSrc();
    return;
    }
    else
    {
    TwRANGE arr = capbright.GetTwRange();
    //TwRANGE arr = (TwRANGE)Marshal.PtrToStructure(Twain.GlobalLock(Handle), typeof(TwRANGE));
    }
    internal class TwRANGE{
    ushort ItemType;
    uint MinValue; /* Starting value in the range. */
    uint MaxValue; /* Final value in the range. */
    uint StepSize; /* Increment from MinValue to MaxValue. */
    uint DefaultValue; /* Power-up value. */
    uint CurrentValue; /* The value that is currently in effect. */
    }
    But I find that its
    MaxValue 1000,
    MinValue 64536;
    Current Value 65636.
    So what is the problem? I could set brightness in the Default UI, but why i can’t set in our Customized Acquire?????
    And I didn’t quite understand what Zoltan Barna said that to use commercial drivers ? to use different version of twain_32.dll ?

    January 20, 2010 at 9:48 pm #24465 Reply
    Thierry
    Participant
    • Topics - 6
    • Replies - 54
    • Total Posts - 60

    @fortunece wrote:

    internal class TwRANGE{
    ushort ItemType;
    uint MinValue; /* Starting value in the range. */
    uint MaxValue; /* Final value in the range. */
    uint StepSize; /* Increment from MinValue to MaxValue. */
    uint DefaultValue; /* Power-up value. */
    uint CurrentValue; /* The value that is currently in effect. */
    }

    In fact the range can be negative, from -1000 to +1000 for ICAP_BRIGHTNESS, ICAP_CONTRAST …

    January 20, 2010 at 9:59 pm #24466 Reply
    jimwatters
    Participant
    • Topics - 2
    • Replies - 72
    • Total Posts - 74

    An application can not force the kind of container a DS will return for a MSG_GET. The code below will not ensure you will receive a Range. Always check the kind of container returned before processing it. The Container passed to the DS to fill should be empty.


    TwCapability capbright = new TwCapability(TwCap.ICAP_BRIGHTNESS, TwOn.Range, TwType.Fix32, -1);
    rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capbright);

    Many DS do not support constraining capabilities when the UI is displayed. If they do, MSG_GET will first need to return an Enumeration or Range.
    MSG_GET to get possible values.
    MSG_SET using the same container type but with only the limited values.

    January 21, 2010 at 2:32 am #24467 Reply
    fortunece
    Participant
    • Topics - 0
    • Replies - 5
    • Total Posts - 5

    Thanks for Thierry’s reply, yes, I change this
    internal class TwRANGE{
    ushort ItemType;
    int MinValue; /* Starting value in the range. */
    int MaxValue; /* Final value in the range. */
    int StepSize; /* Increment from MinValue to MaxValue. */
    int DefaultValue; /* Power-up value. */
    int CurrentValue; /* The value that is currently in effect. */
    }
    but it still get the same result.
    MaxValue 1000,
    MinValue 64536;
    Current Value 65636.
    itemType 7
    stepSize 1
    defaultValue 0
    do you mean that I should do some converter work?

    January 21, 2010 at 2:49 am #24468 Reply
    fortunece
    Participant
    • Topics - 0
    • Replies - 5
    • Total Posts - 5

    jimwatters, Thank you.
    yes, when I do the MSG_GET, No matter what container I set, I just got the Container Type 6 returned.
    so I use the Range Cap.

    And Acctually i can successfully get the ICAP_XRESOLUTION.
    MaxValue 1200,
    MinValue 12;
    Current Value 55 //setted successfully
    itemType 7
    stepSize 1
    defaultValue 150

    What’s the difference between these two capability? Do I need to use Range ContainerType to set the brightness Capa? currently all capa setting use onevalue contype.

    January 21, 2010 at 5:35 am #24469 Reply
    fortunece
    Participant
    • Topics - 0
    • Replies - 5
    • Total Posts - 5

    internal class TwRANGE{
    ushort ItemType;
    TwFix32 MinValue; /* Starting value in the range. */
    TwFix32 MaxValue; /* Final value in the range. */
    int StepSize; /* Increment from MinValue to MaxValue. */
    TwFix32 DefaultValue; /* Power-up value. */
    TwFix32 CurrentValue; /* The value that is currently in effect. */

    }
    Now I using this, so the capa showing correct.
    MaxValue 1000,
    MinValue -1000;
    Current Value -800.
    itemType 7
    stepSize 1
    defaultValue 0
    but the problem is that the image scanned stay no change at all.

    January 21, 2010 at 6:19 am #24470 Reply
    fortunece
    Participant
    • Topics - 0
    • Replies - 5
    • Total Posts - 5

    Now I use the Twack_32.exe program.
    it could set up the DPI, but not the brightness.(through the capability setting, state workflow in special menu)

    so i really really curious about how the default UI did this to set the brightness. waiting for the replies…..

    Is that any twain version issue?
    since the twain_32.dll already in the C:WINDOWS, created in Wednesday, August 04, 2004, I removed it, but when I run our program, it will automatically generated again.(I wonder why)
    and the BenQ disc folder twain_32.dll created in Tuesday, October 22, 1996.

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: ICAP_BRIGHTNESS setting is ignored (?)
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.