TWAIN with Java question

I'm testing the Gnome 4.2 API and it works reasonable well, but, how can you tweak the parameters for better quality scans for b&w pages ?
I need to capture contracts (not for OCR, just the best snapshot I can get for database storage) in b&w.
I can get a fair job, but correction s/w for the HP ScanJet 5300c at the same 150dpi or 300dpi settings does a night and day better job at it than GNOME currently is (at least how I'm capturing currently).
I've tried setting the threshold, shadow, highlight, brighness, contrast, etc. but to no effect.
Here's the settings i've tried:
twain = new Twain();
// Turn off dialogs
twain.setSelectSource(false); // Pop up Select Source window - i.e. the scanner/camera on the PC
twain.setVisible(false); // Pop up Twain user interface.
twain.setPixelType(Twain.RGB);
twain.setThreshold(150);
twain.setShadow(100);
twain.setHighLight(100);
twain.setFeederEnabled(true);
twain.setAutoFeed(true);
twain.setAutoBrightness(true);
// twain.setBrightness(200);
// twain.setContrast(300);
// Quality settings
twain.setCurrentUnits(Twain.INCHES);
twain.setXResolution(dpi); // where dpi=100,150,300
twain.setYResolution(dpi);
// Default to the original size as scanned in.
twain.setXScaling(1.0);
twain.setYScaling(1.0);
twain.setExceptionMask(Twain.SETTHRESHOLD|Twain.SETHIGHLIGHT|Twain.SETSHADOW);
// Grab the image now
Image image = Toolkit.getDefaultToolkit().createImage(twain);
NOTE: At the end, I switch the Image to a JPEG (maximum quality) and storage this in the database. (Currently saving to the file system just to use tools to check the quality of the scan).

Hi ,
EVen I was trying to use the Gnome Twain package, but what di I need first on my machine, I dont have a scanner right now. Where do I get a driver for any TWAIN compliant scanner. I am not able to begin on this.
Thanx,
Rajeev

Similar Messages

  • NewBie Question: Can you make a website completely with Java?

    Greetings my new Fellow Java programmers. My name is Jason and I am a computer programmer and web developer. I am verse in the following:
    1. HTML/XHTML
    2. CSS
    3. Asp.net
    4. VB.Net
    5. SQL
    I want to expand my skills to include:
    1.JAVA
    2. Action Script
    3. Java Script
    4. Ajax
    I have always wanted to learn Java and now I think it is the right time. So my question is can you create a site complete with Java or have a majority of the site functions and look attributed to Java? Is it similar to creating a site with vb.net and asp.net which utilizes html as well? Please explain. I am eager to learn this language. Thank you.
    -RomDog
    ...ROOOOOF!

    RomDog wrote:
    Is it similar to creating a site with vb.net and asp.net which utilizes html as well? Please explain. I am eager to learn this language. Thank you.
    I find it strange that you have to ask this. Of course the end result will be HTML/XHTML, that's what the browsers want. I would think that if you know the .NET side of web development, these concepts (client/server technologies) should already be clear to you.
    The short answer is yes it is possible. However if you want to learn Ajax/Javascript/Actionscript, I would learn those technologies before you learn Java web development as they are completely unrelated. You know that Javascript is not Java, right? You can implement javascript/Ajax in your .NET web applications already.
    Before you want to learn Java web development, learn Java. Seriously, learn basic Java first. It will be a great deal harder (and ultimately a lot more frustrating) to jump directly into the web development side of Java without knowing any of the basics. One of the biggest differences between .NET and Java platforms is that Microsoft basically holds your hand when it comes to making decision about which APIs to use and how to attack a problem; Java leaves you to the wolves to select from a gigantic amount of APIs and tools available that can each solve a problem in their very own way. Freedom is great, but it can be very daunting when you are just beginning.
    So before you even think about web development, I suggest you explore the java tutorial and see if you can get to grips with the language and the tool set.
    [http://java.sun.com/docs/books/tutorial/|http://java.sun.com/docs/books/tutorial/]
    When you are comfortable with the Java language and you are sure that Java web/enterprise development is still something for you, then come back and ask the question again.

  • Need help with Java programming installation question

    Sorry for my lack of knowledge about Java programming, but:....
    A while back I thought I had updated my Java Runtime Environment programming. But I now apparently have two programs installed, perhaps through my not handling the installation properly. Those are:
    J2SE Runtime Environment 5.0 update 5.0 (a 118MB file)
    and:
    Java 2 Runtime Environment, SE v 1.4.2_05 (a 108MB file)
    Do I need both of these installed? If not, which should I uninstall?
    Or, should I just leave it alone, and not worry about it?
    Yeah, I don't have much in the way of technical knowledge...
    Any help or advice would be appreciated. Thank you.
    Bob VanHorst

    Thanks for the feedback. I think I'll do just that. Once in a while I have a problem with Java not bringing up a webcam shot, but when that happens, it seems to be more website based than a general condition.

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Configuration Requirement for Integrated Planning in BI 7.0 with JAVA Addin

    Hi,
    We have BI 7.0 with Java Add-in installation newly migrated to Unicode.
    BW consultants (I am BASIS Consultant) want to use "Integrated Planning".  I already checked IMG link of it & JCO destinations mentioned there are not in J2EE engine.   Even I am not able to create b'cos current setup is not on SLD.
    I would really appreciate your help on below queries :
    1) Can I configure Integrated Planning without using SLD ?
    2) Do I need to install BI JAVA to running Integrated Planning ?
    3) Do I need to install EP & EP Core ?
    I already checked most of SDN thread but sorry couldn't able to get answer to above questions.   I have checked SAP Notes : 901022, 919850, 917950.
    Your early reply would be highly appreciated.
    Thanks & Regards,
    Narsing.

    Hi Balaji,
    Thanks for information.   One thing to update with JAVA/JAVA addin portal core components gets installed.   So I didn't installed EP.  
    Now Integrated Planner is working fine.
    Thanks for your help.
    Best Regards,
    Narsing.

  • A Problem with java

    I have a question with the program.I have write a program that it about polynomial which is in order to desc. But my teacher want me to modify the program to in order to asc. But I don't have any idea with that. Can anyone give me some ideas for this. How can I modify it by easy method? The code is about that,
    public class Polynomial
        private int degree;
        private Node head;
        public static Polynomial addPolys(Polynomial poly1, Polynomial poly2)
            Polynomial polyRes = new Polynomial();
            int power = (poly1.degree > poly2.degree) ? poly1.degree : poly2.degree;
            while (power >= 0)
                Node n1 = poly1.head;
                while (n1 != null)
                    if (n1.power == power)
                        break;
                    n1 = n1.next;
                Node n2 = poly2.head;
                while (n2 != null)
                    if (n2.power == power)
                        break;
                    n2 = n2.next;
                if ((n1 != null) && (n2 != null))
                    polyRes.addNode(n1.coeff + n2.coeff, n1.power);
                else if (n1 != null)
                    polyRes.addNode(n1.coeff, n1.power);
                else if (n2 != null)
                    polyRes.addNode(n2.coeff, n2.power);
                power--;
            return polyRes;       
        public void addNode(int coeff, int power)
            if (head == null)
                head = new Node(coeff, power, null);
                degree = power;
            else
                Node n = head;
                Node last = null;
                while (n != null)
                    if (power > n.power)
                        if (last == null)
                            head = new Node(coeff, power, n);
                        else
                            last.next = new Node(coeff, power, n);
                        degree = power;
                        break;
                    last = n;
                    n = n.next;
                if (n == null)
                    last.next = new Node(coeff, power, null);
        public class Node
            public int coeff;
            public int power;
            public Node next;
            public Node(int coeff, int power, Node next)
                this.coeff = coeff;
                this.power = power;
                this.next = next;
        public String toString()
            StringBuffer strBuf = new StringBuffer();
            Node n = head;
            while (n != null)
                if (n.coeff >= 0)
                    strBuf.append("+ ").append(n.coeff);
                else
                    strBuf.append("- ").append(-(n.coeff));
                if (n.power > 1)
                    strBuf.append("x^").append(n.power);
                else if (n.power == 1)
                    strBuf.append("x");
                strBuf.append("  ");
                n = n.next;
            return strBuf.toString();
    }

    In the future, please use a meaningful subject. "A Problem with Java" contains no information, since by the very fact that you're posting here, it's obvious that you're having a problem with Java. The subject line should give a high level overview of what kind of problem you're having, so people can decide if they're interested and qualified to answer.

  • What Is Wrong With Java? STILL NOT ANSWERED, PLEASE ANSWER!

    So today (10 PM January 20th), the Firefox Plugin Checker said that my Java version was outdated. I also got a pop-up saying that my current version of Java at the time (Java 7 update 10) had vulnerabilities. So to try and fix this, I went to the Java page and downloaded the update (Java 7 update 11).
    To check and see if my update was working, I went to Java's check page, as well as another page I use. And here I discovered a problem. I got a notification that an old version of Java had been detected, and another prompt to download the current version (which I had already done). So I erased all versions of Java from my control panel, and tried to check it again. And when I did, I got this: http://oi50.tinypic.com/35b6xx2.jpg and http://oi47.tinypic.com/15fg37p.jpg.
    As you can see, both pages tell me that I need to install a missing plugin of some sort. So, thinking this would resolve the issue, I clicked the Install Missing Plugin button. This is what it told me was missing: http://oi45.tinypic.com/302uwbl.jpg. So I clicked next to install it.... and got this: http://oi45.tinypic.com/2cici0x.jpg, which I assume means that the plugin did not install. So I pressed Manual Install... and was lead/linked right back to the Java download page (where it all began, and what doesn't seem to be working in the first place)
    I go to check my plugins again (Just to make sure and also for extra information), and it appears to say that my Java version is current (is that what "Java Deployment Toolkit 7.0.110.21" is? I don't know, I am not good at technology at all. Either way, here is what it looks like: http://oi48.tinypic.com/4kxzz4.jpg). So...if it is current, why is it not working (i.e. I am unable to play games, DO MY COLLEGE CLASSWORK, or play Java-based games)?
    If it helps anything, here is what my control panel looks like in regards to Java right now: http://oi45.tinypic.com/2qlxu9t.jpg Am I missing anything that would make Java work?
    And before anyone says that Java is not essential: It may be that way to you, but I need Java to do classwork for college. Veterinary college.
    So, in short, what is going on with Java, and how can I fix it?
    EDITEDITEDIT: I Have found that I can do my classwork without Java.
    HOWEVER, this DOES NOT mean that the problem is solved or over with. I STILL WANT TO KNOW HOW TO FIX THIS PROBLEM AND GET JAVA TO WORK. Even if I never actually need it, I would still like to have a (working!!!) Java version because of two reasons: 1) I would rather have such a program and not need it, than need such a program and not have it, and 2) aesthetics. Sorry to say, but I am very particular about how things look when it comes to my belongings, and the fact that Java is messing up is making me actually stressed. In short, I still want the above issue solved, even if it's just purely for the sake of Peace Of Mind.

    STILL HAVE NOT GOTTEN A REPLY. PLEASE ANSWER ASAP, AS THIS IS STILL IMPORTANT TO ME. COME ON NOW, I KNOW THAT THERE ARE PEOPLE ONLINE AND ANSWERING QUESTIONS!!

  • XSLT Enhancement with Java, Tokenize Functionality

    I tried the following requirement using EXSLT with no luck. Is there any other alternative to tokenize in XSLT 1.0.
    The syntax i have here is  
    <xsl:for-each select="tokenize($this/Field1,',')">
           <xsl:variable name="f1v" select="."/>
         <xsl:for-each select="tokenize($this/Field2,'\|')">
              <xsl:variable name="f2v" select="."/>
              <xsl:for-each select="tokenize($this/Field3,'\|')">
                        <xsl:variable name="f3v" select="."/>
    There are multiple for-each based on tokens
    I am leaning towards to Enhancing XSLT with Java Function. As i have less experience with Java, can anybody help me with the code that can be used by XSLT for Tokenize functionality.
    I have written something like following. I still have errors to fix. But i am not sure about having resultSet or return at the end, to make sure all the tokens were sent to XSLT.
    public class MyStringToken
         public static void main(String [] args)
              String str = "sssd;wwer;ssswwwwdwwwwwwwwwww;wwwwe";
              String delimiter = ";";
              MyStringToken my = new MyStringToken();
              my.getTokens(str,delimiter);
         public void getTokens(String str,String delimiter)
              StringTokenizer st = new StringTokenizer(str,delimiter);
              while(st.hasMoreElements())
                   try
                        String delString = new String(st.nextElement().toString());
                        return (delString);
                   catch(Exception e)
                        e.printStackTrace();
    Any help is appreciated

    Hi,
    I have been searching about, and I have found the next example that maybe can help you, It's a template to tokenize in XSLT 1.0 from the web [http://stackoverflow.com/questions/1018974/tokenizing-and-sorting-with-xslt-1-0]
    <xsl:template name="tokenize">
      <xsl:param name="string" />
      <xsl:param name="delimiter" select="' '" />
      <xsl:choose>
        <xsl:when test="$delimiter and contains($string, $delimiter)">
          <token>
            <xsl:value-of select="substring-before($string, $delimiter)" />
          </token>
          <xsl:text> </xsl:text>
          <xsl:call-template name="tokenize">
            <xsl:with-param name="string"
                            select="substring-after($string, $delimiter)" />
            <xsl:with-param name="delimiter" select="$delimiter" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <token><xsl:value-of select="$string" /></token>
          <xsl:text> </xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    Also I have found the next example of use tokenize in EXSLT from [http://exslt.org/str/functions/tokenize/index.html] It can be that inI your tests you are not using "str:tokenize", no?
    <xsl:template match="a">
       <xsl:apply-templates />
    </xsl:template>
    <xsl:template match="*">
       <xsl:value-of select="." />
          <xsl:value-of select="str:tokenize(string(.), ' ')" />
       <xsl:value-of select="str:tokenize(string(.), '')" />
       <xsl:for-each select="str:tokenize(string(.), ' ')">
          <xsl:value-of select="." />
       </xsl:for-each>
       <xsl:apply-templates select="*" />
    </xsl:template>
    I hope that helps you.
    Best.
    Jorge

  • XSL transformation with java binding

    Hi everyone!
    I am trying to implement na XSL transformation that uses java code binding.
    My XSL looks as follows:
    <i><xsl:stylesheet xmlns:myobj="java.lang.System"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms">
    <xsl:param name="myobj"/>
    <xsl:value-of select="string(myobj:currentTimeMillis())"/>
    </xsl:stylesheet></i>
    Everything works fine - current time is displayed.
    But when I try to use my custom java class the compiler returns an exception:
    <i>com.sapportals.wcm.WcmException: com.sap.engine.lib.xml.util.NestedException: Could not load class: ep.UmeLookup required for execution of 'UmeLookup.isReady'</i>
    My second xsl stytesheet with a reference to custom class looks as follows:
    <i><xsl:stylesheet xmlns:ume="ep.UmeLookup" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms">
    <xsl:param name="ume"/>
    <xsl:value-of select="string(ume:UmeLookup.isReady())"/>
    </xsl:stylesheet></i>
    I developed java class (ep.UmeLookup), made a .jar from it, included the jar archive in a Library project and deployed the library to the J2EE engine.
    It looks like my class is not 'visible' in J2EE engine, while in my opinion it should be. Does anyone know how to change that??
    BR / marek

    Ask this lady a question. Maybe she could answer your question.
    XSLT Mapping With JAVA Enhancement ( For Beginners)

  • Should I do this with Java Code or Stored Procs ? (for best performance)

    Hi All,
    I need to decide where should I implement my business logic, in Java code or Stored procs.
    Here is the requirement :
    - One Order has 70 products (Order_Table )
    - Can be duplicate products, so I have to do summarize / grouping by product
    - For every product, I have to check, if it is entitled for a Bonus product, then I have to Insert one to Bonus_Table.
    - This is done when/after the transaction is SAVED (COMMIT)
    The question is, which one has better PERFORMANCE :
    (1) Create a rowsetIterator on the Order details (70 products) and call a stored procedure to do the logic for every single product (so that the Insert to Bonus_Table done in stored proc). means the stored proc will be called 70 times.
    OR
    (2) After the transaction is COMMITted, call the stored procs ONCE to do the logic for all the products at once.
    OR
    (3) I do all the logic with Java Code within ADF
    Given the requirement above, which approach is most efficient / best performance ?
    Thank you very much,
    xtanto

    Problem with this is that you ask 100 people and you probably get 100 different answers. ;o)
    Many would say that you push as much business logic into the database with your data; others might say you only put data in your database and your business logic is kept on the application server.
    In reality your would probably have a mix of both and your decision would probably be influenced by your own background ...
    Can't be more precise than that.
    Grant

  • Java Step Types with Java Virtual Machine higher than java-6u16?

    Documentation of Java steps says, that these steps are tested with java version 6 update 16. I am talking about the java step types that can be found in directory <TestStand Public>\TestStand 2010\Examples\Java. 
    If I install another java version, e. g. java 7, step "Start JVM" will exit with an error "-4" and error message "Could not launch JVM.". While Debugging source code of JavaCall.dll, I figured the failing code line out:
    "fpCreateJVM(&jvm,(void**)&env,&vm_args);" is the execution of function "JNI_CreateJavaVM" and returns error code -4.
    Till now I could not find out, why the jvm does not start. I guess -4 means "Insufficient memory to create the JVM." (http://zone.ni.com/reference/en-XX/help/370052J-01/tssuppref/infotopics/java_steps_errors/)
    Has anyone an advice for me?

    This post gave me a hint: http://stackoverflow.com/questions/3400292/jni-enomem-from-jni-createjavavm-when-calling-dll-that-us...
    Though my development computer has enough ram, jvm is started within the Teststand process which offers limited memory. I changed JavaCall.c and added parameter "-Xmx64m" to the jvm creation call. Now it works with jre 7.
    Because memory space Teststand offers to the jvm is different on different computers, an implementation would be nice that checks how much memory is available and then passes the calculated <MEM> as parameter "-Xmx<MEM>m". Here is an example implementation: https://forums.oracle.com/forums/thread.jspa?threadID=1546540

  • Unable to map actionscripting with java nested objects

    Hi Experts...,
    Im a newbie in flex and actionscripting.....
    Im unable to map nested java classes and objects with my front end flex application using actionscript....I have searched everywhere almost to my knowledge on the net but failed to find a fix...,
    im having serious trouble reffereing to attributes of an object using another object( which by the way happens to be the parent object).
    Im using hibernate and springs to do the DB transactions....,
    Please help me out with this issue.....
    Thanks for all the help and support in advance....

    Again, I don't work with Java and you should ask Java-related question in Flex (or Java) forum.
    Java or not - you need to package your server side language specific object into something that AS understands (text, XML, AMF object) and load this data into AS via, perhaps, URLLoader. Or you can open socket. Then you parse this data with AS3 code in SWF.

  • How to share a folder with java? in netbios in windows

    hi. I want to write a programa that user can select a directory than
    click the share button and the directory will be shared to other pcs.
    the other pcs can acces this directory like \\servername\shareddirectory
    the question is this. how can i share a director with java or JNI's?
    please help me.
    with my best regards....

    thanks about net share command.
    i know how to use Runtime.getRuntime.exec()
    but i cont find the syntax of net share command.
    can u give an example? i use net help share and i try different
    sytaxes but i cant find the correct one.
    please give an examle about net share command.
    thanks a lot.

  • How to create a xml element for Text with Java?

    Hi @ all,
    I want to tag a part of a text with Java.
    Like the InDesign function "Tag für Text" (maybe "tag for text" in english)
    Is there a way to tag text with Java?
    I tried to autoTag and to markup the text with an existing xml, but only got IdsExceptions.
    here the code where to tag the text:
    XMLElement newXML = parentXML.addXMLElement(VariableTypeUtils.createString("newXML"),OptArg.noVariableType());
    Text[] texts = para.findText(OptArg.noBoolean());
    for (Text text : texts)
       //TODO tag text
    Exception throwing code:
    text.autoTag();
    text.markup(newXML);
    newXML.markup(VariableTypeUtils.createObject(text));

    This is not a Web Dynpro specific question. This forum is for Web Dynpro specifc development aspects. There are other forums for general ABAP development as well as other specific aspects of ABAP development.
    I strong suggest that you review the rules of engagement for forum involvement, Derek.  You have had multiple violations of the rules in the last week.

  • Using GAP math software with Java 1.4, possible?

    Hello all,
    i work at a tech university and a Prof. has the following question:
    Some of his students want to use a free math software package called GAP with their diploma work. Question is: Can they use the GAP package with Java 1.4 Math Class and how does one interact between using GAP and Java 1.4?
    If anyone can help, i would be much obliged.
    Thank you.
    Raymund

    There does not seem to be any such capability, based on the articles in the GAP forum. You might want to look at this article which mentions a means of using Maple and GAP from Java programs.
    http://www.gap-system.org/~gap/Forum/Solomon.1/Andrew.1/JavaMath.1/1.html
    Chuck

Maybe you are looking for

  • BlackBerry Z10, so many frustrating issues

    I have been using my Blackberry Z10 for 4 months.  I still have so many issues that don't work like I would like, and I know if there is something that can fix them.  There is a list, for sure there are more that I don't remember right now.  Battery:

  • InDesign CS3 (WIN): "Enable all profiles" scriptable ?

    Hi, We have to following problem: We have a large collection of IND files from different sources. When creating output, we want the image profiles to be enabled. The only way to do this, it seems, is manually when opening a document with a mismatched

  • Can i optimize a pdf with the pdf pack?

    hi! I've been using acrobat pro in order to benefit from the optimization feature which helps reduce the weight of the files in order to mail them. I was wondering if the pdf pack which has a much lower cost offers this feature. Thank you very much.

  • Bringing YouTube videos to the front

    I am trying to place two separate youtube links on the same page but when I open the website, only one of them is visible. I am aware that I need to bring the other one to the front, but when I do this, the first one (that was previously visible) bec

  • How to stop autoplay?

    Autoplay keeps popping on the desktop and despite ending the task in taskmanager it keeps comming back. How do I stop this