Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, May 30, 2006 9:12:34 AM(UTC)

dimple  
dimple

Groups: Registered
Posts: 2


Hi,

I am using Leadtools 14.5.0.10. I am using LeadTools Twain with C#.net for scanning the documents. I  want to change the bitsperpixel  of the Image Scanned. I am trying to set all possible bitsperpixel to 1 but nothing works. The saved Image is always saved as 8 bits per pixel and is saved as a very big file. We need to scan the image as a grayscale image with 1 bit per pixel. I could not find any code on the forums that could help me. Please help me...My code is as below.

twainSession.GetProperties();
TwainImageResolution imageRes = new TwainImageResolution();
imageRes = _twainSession.ImageResolution;
imageRes.Unit = (int)TwainCapabilityValue.UnitInches;
imageRes.BitsPerPixel = 1;
imageRes.HorizontalResolution = 150;
imageRes.VerticalResolution = 150;
imageRes.XScaling = 1;
imageRes.YScaling = 1;
imageRes.RotationAngle = 90;
imageRes.LeftMargin = 0;
imageRes.RightMargin = 0;
imageRes.TopMargin = 200;
imageRes.BottomMargin = 200;
_twainSession.ImageBitsPerPixel = 1;
_twainSession.EnableAutoFeed = true;
_twainSession.MaxPagesNumber = -1;
_twainSession.TransferFileFormat = (int)TwainCapabilityValue.FileFormatTiff;
_twainSession.TransferCompressionType = (int)TwainCapabilityValue.CompressionLzw;
_twainSession.XResolution = 150;
_twainSession.YResolution = 150;
_twainSession.ImageResolution = imageRes;
_twainSession.SetProperties();

Thanks in Advance
Dimple
First Allied Securities

 

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 1, 2006 11:54:37 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Dimple,
If your Twain driver support the ICAP_PIXELTYPE Twain capability, here's an example on setting it to black and white, which is the 1-bit format:

Dim _twnSession As TwainSession = New TwainSession
_twnSession.Startup(Me, "manufacturer", "productFamily", "version", "application")
_twnSession.SelectSource()
Dim twCap As TwainCapability = New TwainCapability

twCap.Information.ContainerType = TwainContainerType.OneValue
twCap.Information.Type = TwainCapabilityType.ImagePixelType

twCap.OneValue.ItemType = TwainItemType.Uint16
twCap.OneValue.Value = TwainCapabilityValue.PixelTypeBw

_twnSession.SetCapability(twCap, TwainSetCapabilityMode.Set)
_twnSession.Acquire(TwainUserInterfaceFlags.Show Or TwainUserInterfaceFlags.Modal)
_twnSession.Shutdown()

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.078 seconds.