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 Tue May 22, 2012 2:29 am




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Fri Jul 22, 2011 7:17 am 
Offline

Joined: Fri Jul 22, 2011 7:13 am
Posts: 14
This documentation (http://www.dynamsoft.com/help/TWAIN/Web ... oBytes.htm) states that the method "Saves the selected images in buffer to a byte array in the specified file format."

However, the manner in which to specify the file format is not clear. Can you please explain it?

I intend to specify multipage Tiff or PDF from the selection of files.

Thanks,

Jason


Top
 Profile  
 
 Post subject: Re: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Sun Jul 24, 2011 6:41 pm 
Offline
User avatar

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

You can use the GetSelectedImagesSize method to specify the file format. For instance, if you want to save the selected images in buffer to a byte array in TIFF format, you can use the following code:

Code:
Twain.SelectedImagesCount = 2;
Twain.SelectedImageIndex(0) = 4;// Set the 5th image as the first selected image.
Twain.SelectedImageIndex(1) = 3;// Set the 4th image as the second selected image.

var size = Twain.GetSelectedImagesSize(2); //Calculate the size of selected images in TIFF format
     
var ary = new Array(size);
for (var i =0; i<size; i++)
    ary[i] = 0;

Twain.SaveSelectedImagesToBytes(size, ary);

_________________
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  
 
 Post subject: Re: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Mon Jul 25, 2011 4:42 am 
Offline

Joined: Fri Jul 22, 2011 7:13 am
Posts: 14
Thanks. So the GetSelectedImagesSize() has a side-effect of updating the image output mode internally?

If so, I suggest that this be added to the documentation.


Top
 Profile  
 
 Post subject: Re: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Mon Jul 25, 2011 5:42 pm 
Offline
User avatar

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

You are right. And thanks for your suggestion. I'll forward your info to our team and improve the help documentation.

_________________
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  
 
 Post subject: Re: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Tue Jul 26, 2011 5:04 am 
Offline

Joined: Fri Jul 22, 2011 7:13 am
Posts: 14
Ok, can you further list other methods (especially Get* methods) which have similar side-effects? It is unclear to me if/how the various methods are intended to work together.

For example, from the other post, GetImageSize() provides the byte length (?? unit of measure assumed, but not documented - and if it is integral bytes, then why is the return type double?) of a resized version of the image. But with what other methods is GetImageSize() intended to be used?

That's just an example - I'm interested in all others.


Top
 Profile  
 
 Post subject: Re: Specifying the file format for SaveSelectedImagesToBytes()
PostPosted: Tue Jul 26, 2011 6:24 pm 
Offline
User avatar

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

Currently, it is necessary to call GetSelectedImagesSize (also the only Get* method) in order to use SaveSelectedImagesToBytes. You cannot use GetImageSize or GetImageSizeWithSpecifiedType together with SaveSelectedImagesToBytes.

_________________
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  [ 6 posts ] 

It is currently Tue May 22, 2012 2:29 am


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