TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Sun May 20, 2012 3:17 pm




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Image Resolution and resizing
PostPosted: Sat Feb 26, 2011 6:25 am 
Offline

Joined: Sat Feb 26, 2011 6:02 am
Posts: 1
Dears,
I'm using Dynamic Web Twain (V6.1Trial) and I’m trying to solve the following problem:
1. user should be able to scan whatever image size with a 300DPI resolution scanner.
2. I have to save the scanned image as jpeg after resizing it to be (7K size) under even if i need to reduce the image resolution.
for that, I have wrote the following code in Javascript,
the problem is that I’m checking the value of the dynamic Web Twain resolution and find it = 100 even after the debugger passed by the resolution set line of code.

Notes:
1. I'm using the Virtual Web scanner (XPCTWAIN) for the scanning simulation purpose.
2. I need to achieve the 7K size result even if with lower resolution.
3. Trying to just resize the image is not a solution since I have a minimum limit values for the image dimensions.

I would be grateful if you help me to resize my images with whatever resolution to obtain the 7K image as a result.

// Javascript code that handles the scanning action.
function ScanImage(sender, args) {
debugger;
var sourceData = $get(source);
with (document.all) {
activeForm.DynamicWebTwain1.SelectSourceByIndex(sourceData.options.selectedIndex);
activeForm.DynamicWebTwain1.CloseSource();
activeForm.DynamicWebTwain1.OpenSource();
activeForm.DynamicWebTwain1.IfDisableSourceAfterAcquire = true;
activeForm.DynamicWebTwain1.Resolution = 75; // Resolution = 100 here !
activeForm.DynamicWebTwain1.AcquireImage();
}
return false;
}

//Javascript function that resize the scanned image to a smaller dimensions to try to get the required size 7 K.
function CompressImage() {
activeForm.DynamicWebTwain1.LoadImage(filepath);
activeForm.DynamicWebTwain1.ChangeImageSize(activeForm.DynamicWebTwain1.CurrentImageIndexInBuffer, 90, 114, 1);
activeForm.DynamicWebTwain1.SaveasJPEG(filepath, activeForm.DynamicWebTwain1.CurrentImageIndexInBuffer);
return false;
}


Top
 Profile  
 
 Post subject: Re: Image Resolution and resizing
PostPosted: Sun Feb 27, 2011 11:40 pm 
Offline
User avatar

Joined: Tue Mar 08, 2005 12:23 am
Posts: 1075
Hi Samar,

Besides using Resolution and ChangeImageSize, you can also change the pixel type to reduce the image size. Black&White and gray images are expected to have smaller size. JPEGQuality can also contribute to the image size.

You can take a look at the following page for more information:
http://kb.dynamsoft.com/questions/170/H ... loading%3F

Thanks.

_________________
Catherine Sea
TWAIN Support Team
TWAIN ActiveX/Plug-in for Web Applications, Scanner COM Control
TWAIN .NET Component/SDK for Desktop Applications

Follow me @Twitter, Facebook
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

It is currently Sun May 20, 2012 3:17 pm


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog