Image processing made easy!

ImageKit.NET2: Frequently Asked Questions

Below are a few of the most frequently asked questions by users of the ImageKit.NET2. Click on the question number to jump to the answer.

No. Question Date
18 Q. When I try to run an application containing the ImageKit.NET2 on an environment that is not connected to the internet, it can take a long time for the application to start up. Why?

Is there anything I can do about it?
2010/05/19
17 Q. How do I convert an image's height or width from pixels to inches or centimeters 2009/08/20
16 Q. Can an application that uses TWAIN run on a 64 bit OS? 2009/06/03
15 Q. When I run my program in Visual Studio in debug mode, the ImageKit.NET Effect or Scan functions are much much slower than they are when running the EXE outside of Visual Studio. What can I do to make my program run faster when I am debugging? 2009/06/03
14 Q. How do I create a mirror image or flip an image? 2009/06/03
13 Q. With the scan driver's UI suppressed, how can I scan multiple areas of the document? 2009/06/03
12 Q. How can I use the scanner's automatic paper detection functions when using my own custom built scan interface (When the scan driver's UI is suppressed) ? 2009/06/03
11 Q. How can I scan only one part of the paper when using my own custom built scan interface (When the scan driver's UI is suppressed) ? 2009/06/03
10 Q. I know that the Scan control supports standard TWAIN capability but what about support for independent manufacturer's custom capability? 2009/06/03
9 Q. In a new project, I placed the controls on the form but when I build the project, I get an error!! 2009/06/03
8 Q. How do I change the resolution property value of a raster image? 2009/06/03
7 Q. How do I create a multipage tiff image using the ImageKit.NET2? 2009/06/03
6 Q. In the ImageKit.NET2 (WinForm) Thumbnail control, how is the size of a thumbnail image determined? 2009/06/03
5 Q. When I drag a file into the Thumbnail Control (WinForm), how can I retrieve the filename and path? 2009/06/03
4 Q. I want to use the ImageKit.NET2 Effect and Scan classes without using the component. Is that possible? 2009/06/03
3 Q. Does the ImageKit.NET2 support ClickOnce deployment? 2009/06/03
2 Q. I installed the ImageKit.NET2 two weeks ago and it doesn't work anymore. 2009/06/03
1 Q. When I install or uninstall the ImageKit.NET2 in Windows Vista, I am unable to do so and I get a message that says to control the support administrator or package vendor. HELP! 2009/06/03

 


No. Question Date
  Answer  
18 Q. When I try to run an application containing the ImageKit.NET2 on an environment that is not connected to the internet, it can take a long time for the application to start up. Why?

Is there anything I can do about it?
2010/05/19
 

A. The ImageKit.NET2 assemblies are digitally signed. To validate an application using a digitally signed assembly, a PC may try to download the CRL (certificate revocation list). If the PC is not connected to the internet, the application will not start up until after the attempt to download the CRL has timed out.

To avoid this problem you can set the PC (that is not connected to the internet) so that it will not download the CRL in the following way:

     1. From the Control Panel, choose Internet Options
     2. In the Internet Properties Dialog, select the Advanced tab
     3. Uncheck the box called "Check for Publisher's Certificate Revocation"

Another way to avoid this problem for PCs (that are not connected to the internet) and have .NET Framework 2.0 Service Pack 1 or above, you can set the following in the application's exe.config:

     <configuration>
       <runtime>
         <generatePublisherEvidence enabled="false"/>
       </runtime>
     </configuration>


This will disable the check to CRL when the application starts up.

17 Q. How do I convert an image's height or width from pixels to inches or centimeters 2009/08/20
 

A. Please refer to the following example.

When using an image set in the Image property:

In VB.NET:
     Dim inchX, inchY As Single
     Dim cmX, cmY As Single

     Dim bmp As System.Drawing.Bitmap = ImageKit1.Image

     If bmp.HorizontalResolution <> 0 Then
          'into inches
          inchX = bmp.Width / bmp.HorizontalResolution
          'from inches to centimeters
          cmX = inchX * 2.54
     End If

     If bmp.VerticalResolution <> 0 Then
          'into inches
          inchY = bmp.Height / bmp.VerticalResolution
          'from inches to centimeters
          cmY = inchY * 2.54
     End If

In C#:
     float inchX, inchY;
     float cmX, cmY;

     System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)imageKit1.Image;
     if (bmp.HorizontalResolution != 0)
     {

          //into inches
          inchX = bmp.Width / bmp.HorizontalResolution;
          //from inches to centimeters
          cmX = inchX * (float)2.54;
     }

     if (bmp.VerticalResolution != 0)
     {
          //into inches
          inchY = bmp.Height / bmp.VerticalResolution;
          //from inches to centimeters
          cmY = inchY * (float)2.54;
     }

16 Q. Can an application that uses TWAIN run on a 64 bit OS? 2009/06/03
 

A. Yes, but it has to run as a 32 bit application. Also, the target platform must be (x86). If the application is built with a target platform of (x64) or (Any CPU), then the TWAIN application will not run.

15 Q. When I run my program in Visual Studio in debug mode, the ImageKit.NET Effect or Scan functions are much much slower than they are when running the EXE outside of Visual Studio. What can I do to make my program run faster when I am debugging? 2009/06/03
 

A. You will need to disable your Managed Debug Assistant (MDA). For details, please refer to:

http://msdn.microsoft.com/en-us/library/d21c150d.aspx

14 Q. How do I create a mirror image or flip an image? 2009/06/03
 

A. Use the Effect interface's Rotation method and set the angle parameter to 0. To create a mirror image, set the xTurn parameter to True. To flip the image, set the yTurn parameter to True.

13 Q. With the scan driver's UI suppressed, how can I scan multiple areas of the document? 2009/06/03
 

A. It is not possible to scan multiple areas simultaneously. For that reason, you must execute multiple scans to scan different areas of the document. See example code below:

To perform multiple scans of the document plate:

In VB.NET:

If ImageKit1.Scan.Initialize(Me.Handle, 1, 0, "1.00", "NEWTONE Corp.", "ImageKit", "ImageKit.NET Scan Sample") = False Then Exit Sub
     ImageKit1.Scan.ClearProperty()
     ImageKit1.Scan.DataSourceName = "xxxxxxx"
'datasource name
     If ImageKit1.Scan.OpenDataSource() = False Then
          ImageKit1.Scan.Terminate()
          Exit Sub
     End If

     ImageKit1.Scan.TransferMode = ScanTransfer.Memory
     ImageKit1.Scan.Compression = ScanCompression.None
     ImageKit1.Scan.UserInterface = ScanUserInterface.Suppress
     ImageKit1.Scan.Mode = ScanMode.DocumentPlate
     ImageKit1.Scan.Unit = ScanUnit.Inch
     ImageKit1.Scan.PaperSize = ScanPaperSize.UserSize
'or use a negative number

     'the first scan area
     'set the area to be scanned

     ImageKit1.Scan.Rect = New RectangleF(0, 0, 1, 1)
     'set other necessary scan properties here
     ImageKit1.Scan.Execute()

     'the second scan area
     'set the area to be scanned

     ImageKit1.Scan.Rect = New RectangleF(3, 3, 1, 1)
     'set other necessary scan properties here
     ImageKit1.Scan.Execute()

     ImageKit1.Scan.CloseDataSource()
     ImageKit1.Scan.Terminate()

In C#:

if (imageKit1.Scan.Initialize(this.Handle, 1, 0, "1.00", "NEWTONE Corp.", "ImageKit", "ImageKit.NET Scan Sample") == false) return;
     imageKit1.Scan.ClearProperty();
     imageKit1.Scan.DataSourceName = 'xxxxxxx';
//datasource name
     if (imageKit1.Scan.OpenDataSource() == false)
     {           imageKit1.Scan.Terminate();
          return;
     }

     imageKit1.Scan.TransferMode = ScanTransfer.Memory;
     imageKit1.Scan.Compression = ScanCompression.None;
     imageKit1.Scan.UserInterface = ScanUserInterface.Suppress;
     imageKit1.Scan.Mode = ScanMode.DocumentPlate;
     imageKit1.Scan.Unit = ScanUnit.Inch;
     imageKit1.Scan.PaperSize = ScanPaperSize.UserSize;
//or use a negative number

     //the first scan area
     //set the area to be scanned

     imageKit1.Scan.Rect = new RectangleF(0, 0, 1, 1)
     //set other necessary scan properties here
     imageKit1.Scan.Execute();

     //the second scan area
     //set the area to be scanned

     imageKit1.Scan.Rect = new RectangleF(3, 3, 1, 1);
     //set other necessary scan properties here
     imageKit1.Scan.Execute();

     imageKit1.Scan.CloseDataSource()
     imageKit1.Scan.Terminate();

Be sure to any necessary codein the AfterScan event.

If using an ADF, it will not be possible to scan multiple times for each sheet of paper. You will have to scan all the paper setting the first area, then place the paper into the ADF again and scan for the second area, and so on.

 
12 Q. How can I use the scanner's automatic paper detection functions when using my own custom built scan interface (When the scan driver's UI is suppressed) ? 2009/06/03
 

A. Confirm that your datasource supports automatic paper detection by using the IsCapabilitySupported method. If your datasource supports automatic paper detection then set the PaperSize property to UndefinedSize and set the BorderDetection property to True. Note that there are some datasources that work regardless of what value is set in the BorderDetection property.

11 Q. How can I scan only one part of the paper when using my own custom built scan interface (When the scan driver's UI is suppressed) ? 2009/06/03
 

A.
1) If the datasource supports pre-determined sizes:
Set the scan area and set the PaperSize property to UserSize (or to a negative number).

2) If the datasource does not support pre-determined sizes: Set the scan area and set the PaperSize property to UserSize.

For details, please refer to the PaperSize property explanation in the ImageKit.NET2 Help file. To retreive the paper size supported by the datasource, use the GetCapabilityEnumToSingle method.
 
10 Q. I know that the Scan control supports standard TWAIN capability but what about support for independent manufacturer's custom capability? 2009/06/03
 

A. The ImageKit.NET2 Scan control supports the custom capabilities of 3 scanner manufacturers; Canon, Epson, and Panasonic. Below is a list of the custom capabilites:

Canon (DR Scanner):

Dropout Color
Auto Detect Paper Size
Moire Filter
Autodetect Color/B&W
Rotate Image
Autodetect Text Orientation
Highlight Edge
Skip Blank Page
Punch Hole Removal

Epson:

Extended UI Mode (Automatic, Home, Office, Professional, etc.)
Rotate Back Of Page
Adjust Scan Speed
Unsharp Mask
Moire Filter
Autodetect Paper Size
Gamma Correction
Autodetect Color/B&W
Skip Blank Page
Punch Hole Removal

Panasonic:

Autodetect Color/B&W
Multi-stream
Dynamic Threshold
Adjust Scan Speed
Image Quality
Deskew Smoothing
Skip Blank Page
Punch Hole Removal

 
9 Q. In a new project, I placed the controls on the form but when I build the project, I get an error!! 2009/06/03
 

A. In your project, please make sure that all of the necessary ImageKit.NET2 assemblies are properly referenced. Listed below is the control name and the assemblies that must be referenced.

WinForm
(1) When using the ImageKit control (Newtone.ImageKit.Win.ImageKit.dll):
Newtone.ImageKit.Common.dll, Newtone.ImageKit.Effect.dll, Newtone.ImageKit.File.dll, Newtone.ImageKit.Scan.dll
(2) When using the Thumbnail control (Newtone.ImageKit.Win.Thumbnail.dll):
Newtone.ImageKit.Common.dll, Newtone.ImageKit.File.dll
(3) When using the Play, Preview, or Record controls (Newtone.ImageKit.Win.WebCamera.dll):
Newtone.ImageKit.Common.dll

WebForm
(1) When using the ImageKit control (Newtone.ImageKit.Web.ImageKit.dll):
Newtone.ImageKit.Common.dll, Newtone.ImageKit.File.dll
(2)When using the Thumbnail control (Newtone.ImageKit.Web.Thumbnail.dll):
Newtone.ImageKit.Common.dll, Newtone.ImageKit.File.dll

 
8 Q. How do I change the resolution property value of a raster image? 2009/06/03
  A. The following code will change the resolution property value of the image set in the Image property

In VB.NET:

Dim bmp As System.Drawing.Bitmap = ImageKit1.Image.Clone()
bmp.SetResolution(300, 300)
ImageKit1.Image = bmp.Clone()


In C#:

System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)imageKit1.Image.Clone();
bmp.SetResolution(300, 300);
imageKit1.Image = (System.Drawing.Image)bmp.Clone();
 
7 Q. How do I create a multipage tiff image using the ImageKit.NET2? N/A
  A. Please refer to the following examples:

1. To save images retrieved from scanners or digital cameras...

In VB.NET:

Dim Ret As Boolean
ImageKit1.File.FileName = "abc.tif"
ImageKit1.File.TiffAppend = True
  'enable multipage tiff

ImageKit1.Scan.Transfer = Newtone.ImageKit.ScanTransfer.Memory  'or Newtone.ImageKit.ScanTransfer.Native
Ret = ImageKit1.Scan.Execute()  'execute the scan
ImageKit1.File.CloseMultiTiff()  'close multipage tiff file. Be sure to execute this after the File.SaveImageToFile method has been executed.

'In the AfterScan event:
Private Sub ImageKit1_AfterScan(ByVal sender As Object, ByVal e As Newtone.ImageKit.AfterScanEventArgs) Handles ImageKit1.AfterScan

ImageKit1.File.SaveImageToFile(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1)

End Sub

In C#:

bool Ret;
imageKit1.File.FileName = "abc.tif";
imageKit1.File.TiffAppend = true;
  //enable multipage tiff

imageKit1.Scan.Transfer = Newtone.ImageKit.ScanTransfer.Memory
  //or Newtone.ImageKit.ScanTransfer.Native
Ret = imageKit1.Scan.Execute();  //execute the scan
imageKit1.File.CloseMultiTiff();  //close multipage tiff file.Be sure to execute this after the File.SaveImageToFile method has been executed.

//In the AfterScan event:
private void imageKit1_AfterScan(object sender,
Newtone.ImageKit.AfterScanEventArgs e)
{
imageKit1.File.SaveImageToFile(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1);
}


2. To save mulitple image files into one multipage file...

In VB.NET:

Dim I As Integer

ImageKit2.File.FileName = "abc.tif"
ImageKit2.File.TiffAppend = True
  'enable multipage tiff

ImageKit1.LayerNumber = -1
ImageKit1.File.LoadPage = 0


'load and save images 001.jpg ... 005.jpg into one file
For I = 1 To 5
   ImageKit1.File.FileName = I.ToString("d03") + ".jpg"
  'set the file name
   ImageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.Load)
   ImageKit2.File.SaveImageToFile(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, ImageKit1.Image)
Next I
ImageKit2.File.CloseMultiTiff()
  'close multipage tiff file. Be sure to execute this after the File.SaveImageToFile method has been executed.

In C#:

int i;

imageKit2.File.FileName = "abc.tif";
imageKit2.File.TiffAppend = true;
  //enable multipage tiff

imageKit1.LayerNumber = -1;
imageKit1.File.LoadPage = 0;


//load and save images 001.jpg ... 005.jpg into one file
for (i = 1; i < = 5; i++)
{
   imageKit1.File.FileName = i.ToString("d03") + ".jpg";
  //set the file name
   imageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.Load);
   imageKit2.File.SaveImageToFile(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, imageKit1.Image);
}
imageKit2.File.CloseMultiTiff();
  'close multipage tiff file.Be sure to execute this after the File.SaveImageToFile method has been executed.
 
6 Q. In the ImageKit.NET2 (WinForm) Thumbnail control, how is the size of a thumbnail image determined? 2009/06/03
  A. The total display area of the Thumbnail control is divided by the number of rows and number of columns to get size of an individual thumbnail cell (minus border width, cell spacing, etc). The display area within this thumbnail cell will have a width of 80% of the thumbnail cell's width and a height of 80% of the thumbnail cell's height. The thumbnail image will be scaled to fit within this display area and centered within the thumbnail cell. This is the maximum size of the thumbnail image. To adjust the thumbnail image size (up to this maximum size), use the ImageSize property.
 
5 Q. When I drag a file into the Thumbnail Control (WinForm), how can I retrieve the filename and path? 2009/06/03
  A. Use the Thumbnail control's DragDrop event:

In VB.NET:

Private Sub Thumbnail1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Thumbnail1.DragDrop

Dim FileName As String() = DirectCast(e.Data.GetData(DataFormats.FileDrop), String())

End Sub


In C#:

private void thumbnail1_Private Sub Thumbnail1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)

{
string[] FileName = (string [])e.Data.GetData(DataFormats.FileDrop);
}
 
4 Q. I want to use the ImageKit.NET2 Effect and Scan classes without using the component. Is that possible? 2009/06/03
  A. Yes, the ImageKit.NET2 classes can be used. Please refer to the ImageKit.NET2 Class Library Reference for details.
 
3 Q. Does the ImageKit.NET2 support ClickOnce deployment? 2009/06/03
  A. Yes, the ImageKit.NET2 supports ClickOnce deployment.
 
2 Q. I installed the ImageKit.NET2 two weeks ago and it doesn't work anymore. 2009/06/03
  A. Please confirm that your license has been activated. For details, please refer to the file "License Activation.pdf" in the "Activation" folder under the "Tool" folder in the directory where you installed the ImageKit.NET2.
 
1 Q. When I install or uninstall the ImageKit.NET2 in Windows Vista, I am unable to do so and I get a message that says to control the support administrator or package vendor. HELP! 2009/06/03
  A. In Windows Vista, do the following: Go to the Control Panel and select "Classic View". Click on "User Accounts". Click "Turn User Account Control on or off". Then uncheck the box "Use User Account Control (UAC) to help protect your computer". Click the "OK" button. After that, try installing or uninstalling the ImageKit.NET2 again.