Changing the Bit Depth in C#

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
KeithH
Posts: 1
Joined: Wed Mar 25, 2009 12:06 am

Changing the Bit Depth in C#

Post by KeithH »

Using VSTwain 4.4. Developing in C# using VS 2008.

I'm banging my head with this and can't find anything in the FAQ or forums. I'm sure I am missing something simple.

I want to set the Bit Depth to 8 in C#. Your examples are in VB, but it is fairly straight forward.

VSTwain1.OpenDataSource();
VSTwain1.PixelType = PixelType.RGB;
if (VSTwain1.IsCapSupported())
{
VSTwain1.Capability = (int)DeviceCapability.IBitDepth;
VSTwain1.CapType = CapType.OneValue;
VSTwain1.CapValue = 16;
VSTwain1.SetCap();
}

Couple of things. VSTwain1.Capability = DeviceCapability.IBitDepth; gives a compile time error Cannot implicitly convert type 'Vintasoft.Twain.DeviceCapability' to 'int'. An explicit conversion exists (are you missing a cast?)

But when I run the above code it errors at VSTwain1.SetCap(); Error to Set Capability value at Vintasoft.Twain.VSTwain.SetCap()

I'm not sure what I am doing wrong?

Thanks for the Help
Alex
Site Admin
Posts: 2313
Joined: Thu Jul 10, 2008 2:21 pm

Re: Changing the Bit Depth in C#

Post by Alex »

Hello Keith,

Sorry for a delay. You already have received answer from our support team - you should change PixelType to Palette if you want to acquire palette images:

Code: Select all

VSTwain1.PixelType = PixelType.Palette;
Best regards, Alexander
Post Reply