←Select platform

ImageFormat Property

Summary
Gets or sets the image format.

Syntax
C#
C++/CLI
Python
public RasterImageFormat ImageFormat { get; set; } 
public: 
property RasterImageFormat ImageFormat { 
   RasterImageFormat get(); 
   void set (    RasterImageFormat ); 
} 
ImageFormat # get and set (TwainFastConfiguration) 

Property Value

The image format.

Remarks

For more information, refer to Fast TWAIN (Scan Configurations).

Example
C#
using Leadtools; 
using Leadtools.Twain; 
 
 
public void twain_FastConfiguration(object sender, TwainFastConfigurationEventArgs e) 
{ 
   // ... set your code here 
   e.Stop = false; 
} 
 
public void FindFastConfigurationExample(IntPtr parent) 
{ 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   session.EnableFastConfigurationEvent = true; 
   session.FastConfiguration += new EventHandler<TwainFastConfigurationEventArgs>(twain_FastConfiguration); 
 
   List<TwainFastConfiguration> twFastConfig = new List<TwainFastConfiguration>(); 
   TwainFastConfiguration tempFastConfig = new TwainFastConfiguration(); 
   tempFastConfig = TwainFastConfiguration.Default; 
 
   tempFastConfig.TransferMechanism = TwainTransferMode.File; 
   tempFastConfig.ImageFormat = Leadtools.RasterImageFormat.Bmp; 
   tempFastConfig.BitsPerPixel = 1; 
   twFastConfig.Add(tempFastConfig); 
 
   tempFastConfig.TransferMechanism = TwainTransferMode.File; 
   tempFastConfig.ImageFormat = Leadtools.RasterImageFormat.Tif; 
   tempFastConfig.BitsPerPixel = 1; 
   twFastConfig.Add(tempFastConfig); 
 
   TwainFindFastConfigurationResult fastConfigRes; 
 
   try 
   { 
      fastConfigRes = session.FindFastConfiguration(Path.Combine(LEAD_VARS.ImagesDir, ""), TwainFastUserInterfaceFlags.Show, 0, 1, twFastConfig); 
 
      string msg; 
      MessageBox.Show("FindFastConfig method was successful"); 
 
      msg = String.Format("Result Scan Configs count = {0}", fastConfigRes.Tested.Count); 
      MessageBox.Show(msg); 
 
      msg = String.Format("Transfer Mode = {0}\nFile Format = {1}\nBuffer Size = {2}\nRequired Time = {3}\n", 
         fastConfigRes.Tested[0].TransferMechanism, 
         fastConfigRes.Tested[0].ImageFormat, 
         fastConfigRes.Tested[0].BufferSize, 
         fastConfigRes.Tested[0].RequiredTime); 
      MessageBox.Show(msg, "Tested Scan Configurations..."); 
 
      msg = String.Format("Transfer Mode = {0}\nFile Format = {1}\nBuffer Size = {2}\nRequired Time = {3}\n", 
         fastConfigRes.Best.TransferMechanism, 
         fastConfigRes.Best.ImageFormat, 
         fastConfigRes.Best.BufferSize, 
         fastConfigRes.Best.RequiredTime); 
      MessageBox.Show(msg, "Best Scan Configurations..."); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
 
   session.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.