- This topic has 1 reply, 2 voices, and was last updated 15 years, 1 month ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
Forums › TWAIN Classic › JTwain and page frames
I’m developing a java applet that must retrieve an image from a scanner. I’m using the JTwain libraries to connect to my scanning device and acquire the image. The only problem is that the scanner retrieves the entire scanning area, while all I want is just a subset of that (a frame), exaclty the top-left corer (in px, width=210, height=237). User Interface is disabled. This is a piece of code:
…
selectedSource.open();
selectedSource.setUnits(JTwainConstants.TWUN_PIXELS);
selectedSource.setXResolution(200.0);
selectedSource.setYResolution(200.0);
selectedSource.setUIEnabled(false);
ValueContainerOneValue valuePixelType = new ValueContainerOneValue();
valuePixelType.setItem(new ItemTypeInteger(Source.TWTY_UINT16, JTwainConstants.TWPT_RGB));
selectedSource.setCapability(Source.ICAP_PIXELTYPE, valuePixelType);
acquiredImage = selectedSource.acquireImage();
selectedSource.close();
…
How can I handle that?
________
Honda Rc171
I am not familiar with JTwain, but I know API of the Morena – Image Acquisition Framework for Java™ Platform. It has
setFrame(double left, double top, double right, double bottom) method. Your described communication in Morena API is as follows:
…
source.setUnits(TwainConstants.TWUN_PIXELS);
source.setXResolution(200);
source.setYResolution(200);
source.setPixelType(TwainConstants.TWPT_RGB);
source.setFrame(0,0,210,237);
image=Toolkit.getDefaultToolkit().createImage(source);