LEADTOOLS Support
Imaging
Imaging SDK Questions
Can Not change Size of the Image ...Please Help.....
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, May 30, 2006 9:12:34 AM(UTC)
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
#2
Posted
:
Thursday, June 1, 2006 11:54:37 AM(UTC)
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.
LEADTOOLS Support
Imaging
Imaging SDK Questions
Can Not change Size of the Image ...Please Help.....
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.