Home › Forums › TWAIN Classic › How to set the resolution (DPI)? › Reply To: How to set the resolution (DPI)?
November 17, 2008 at 5:16 am #24004
I am using JTwain and facing the same problem that dabd is facing. I have verified that the resolution (200 x 200) in which I am trying to scan is supported by the scanner. In fact I also verified that when UI is enabled we can see that the driver (in my case HP Scanner dialogue) has actually received the DPI settings, though getCurrentXResolution and getCurrentYResolution are reporting 1.0, but when the scanned image is verified in MSPaint it reports 96 x 96 DPI and GIMP reports 72 x 72 DPI.
The code snippet used is as below
source.setUnits( JTwainConstants.TWUN_PIXELS );
source.setXResolution( 200.00 );
source.setYResolution( 200.00 );
ImageIO.write( source.acquireImageAsBufferedImage(), "jpeg", bos );
JpegBase64 = Base64.encode( bos.toByteArray() );
source.close();
Any help will be much appreciated.