Image processing made easy!

ImageKit.NET: Frequently Asked Questions

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

No. Question Date
14 Q. On a 64 bit Operating System, is it possible to run an application that uses TWAIN? 03/31/2009
13 Q. In debug mode in Visual Studio 2005 and 2008, it takes much longer for an effect process or scan process to execute than the same process executed from a compiled EXE. Is there anything that can be done to speed up processing during debug mode? 03/31/2009
12 Q. How can I "mirror" or "flip" an image? 02/24/2009
11 Q. Using a custom-built scan interface, how can I scan multiple areas on the same paper? 07/17/2008
10 Q. I have built my own scan interface and would like to be able to use the scanner's automatic paper detection functions. How do I do that? 07/17/2008
9 Q. How do I draw text to an image or to the ImageKit control? 02/21/2008
8 Q. I built an application with the ImageKit.NET and after a while, it stopped working! What is the problem? ? N/A
7 Q. How can I change the value of a raster image's resolution property?  N/A
6 Q. How do I create a multipage tiff image using the ImageKit.NET? N/A
5  Q. In the ImageKit.NET (WinForm) Thumbnail control, how is the size of a thumbnail image determined? N/A
4 Q. Using the ImageKit.NET (WinForm) Thumbnail control, how can I retrieve the filename of the file dropped using the DragDrop event? N/A
3 Q. Can I use ImageKit.NET Effects and Scan functions, not through the component, but through the class files? N/A
2 Q. Does the ImageKit.NET support NoTouch Deployment? N/A
1 Q. Does the ImageKit.NET support ClickOnce Deployment? N/A

 

No. Question Date
  Answer  
14 Q. On a 64 bit Operating System, is it possible to run an application that uses TWAIN? 03/31/2009
 

A. Yes, but it must run as a 32 bit application. What is more, in applications developed in Visual Studio 2005 and 2008, it is necessary to build the application with the target format set to "x86". If the target format is set to "any CPU", the application will not run on a 64 bit OS.

 
13 Q. In debug mode in Visual Studio 2005 and 2008, it takes much longer for an effect process or scan process to execute than the same process executed from a compiled EXE. Is there anything that can be done to speed up processing during debug mode? 03/31/2009
 

A. Disable the Managed Debugging Assistant (MDA). For more information, please refer to the following MSDN article:
http://msdn.microsoft.com/en-us/library/d21c150d.aspx

 
12 Q. How can I "mirror" or "flip" an image? 02/24/2009
 

A. Use the Effect.Rotation method. Set the angle parameter to 0. Then, to "mirror" the image, set the xTurn parameter to true. This will reverse the image along the X axis. To "flip" the image, set the yTurn parameter to true. This will reverse the image along its Y axis.

 
11 Q. Using a custom-built scan interface, how can I scan multiple areas on the same paper? 07/17/2008
 

A. It is not possible to scan multiple areas simultaneously so you must execute the scan multiple times:

Example: Scanning multiple times from the document plate

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 default value

'First scan
'set the scanning area

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

'Second scan
'set the scanning area

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

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


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 default value

//First scan
//set the scanning area

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

//Second scan
//set the scanning area

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

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

Note: Appropriate code to display or save scanned data should be written in the AfterScan event.

 
10 Q. I have built my own scan interface and would like to be able to use the scanner's automatic paper detection functions. How do I do that? 07/17/2008
 

A. To confirm that your scanner supports automatic paper detection, use the IsCapSupported method. If the scan datasource supports automatic detection, set the PaperSize to UndefinedSize and the BorderDetection to True. For some datasources, the BorderDetection property value is ignored.

 
9 Q. How do I draw text to an image or to the ImageKit control? 02/21/2008
 

A. Please refer to the following code:

1) To draw text to the ImageKit control:

VB.NET:
Dim g As Graphics = ImageKit1.CreateGraphics()
Dim drawFont As Font = new Font("Arial", 16)
Dim drawBrush As SolidBrush = new SolidBrush(Color.Black)
g.DrawString("Sample Text", drawFont, drawBrush, 150.0, 50.0)
g.Dispose()

Note: When the image is redisplayed, the text will disappear

C#:
Graphics g = imageKit1.CreateGraphics();
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
g.DrawString("Sample Text", drawFont, drawBrush, 150.0F, 50.0F);
g.Dispose();

Note: When the image is redisplayed, the text will disappear

2) To draw text to the image:

VB.NET:

Dim newGraphics As Graphics = Graphics.FromImage(newImage)
Dim drawFont As Font = New Font("Arial", 16)
Dim drawBrush As SolidBrush = New SolidBrush(Color.Black)
newGraphics.DrawString("Sample Text", drawFont, drawBrush, 150.0, 50.0)
newGraphics.Dispose()
ImageKit1.Image = newImage
If bitCount < = 8 Then
   ImageKit1.Effect.ConvertColor(bitCount, False, False, 128)
End If


C#:

int bitCount = imageKit1.BitCount;
if (bitCount < = 8)
{
   imageKit1.Effect.SourceMask = null;
   imageKit1.Effect.ConvertColor(24, false, false, 128);
}
Image newImage = imageKit1.Image;
Graphics newGraphics = Graphics.FromImage(newImage);
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
newGraphics.DrawString("Sample Text", drawFont, drawBrush, 150.0F, 50.0F);
newGraphics.Dispose();
imageKit1.Image = newImage;
if (bitCount < = 8)
   imageKit1.Effect.ConvertColor(bitCount, false, false, 128);
imageKit1.Refresh();

 
8 Q. I built an application with the ImageKit.NET and after a while, it stopped working! What is the problem?
  A. When using multiple ImageKit controls or when using the class library, the license must be manully enabled. For details about this, please refer to the text files under the directory where you installed the ImageKit.NET License. (License installer "ImageKitNETLIC.msi")  
7 Q. How can I change the value of a raster image's resolution property?  N/A
 

A. Please refer to the following code:

To change the resolution value to 300 for the image set in the Image property:

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


C#:
System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)imageKit1.Image.Clone();
bmp.SetResolution(300, 300);

 
6 Q. How do I create a multipage tiff image using the ImageKit.NET? N/A
  A. Please refer to the following examples:

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

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

'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

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

//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...

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

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
 
5 Q. In the ImageKit.NET (WinForm) Thumbnail control, how is the size of a thumbnail image determined? N/A
 

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.

 
4 Q. Using the ImageKit.NET (WinForm) Thumbnail control, how can I retrieve the filename of the file dropped using the DragDrop event? N/A
 

A. Please refer to the following VB.NET and C# code:

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


C#:

private void thumbnail1_Private Sub Thumbnail1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
     string[] FileName = (string [])e.Data.GetData(DataFormats.FileDrop);
}

 
3 Q. Can I use ImageKit.NET Effects and Scan functions, not through the component, but through the class files? N/A
  A. Yes. ImageKit.NET contains a class library. Please refer to the ImageKit.NET Class Reference for details.  
2 Q. Does the ImageKit.NET support "NoTouch" Deployment? N/A
  A. Yes, the ImageKit.NET supports both "NoTouch" and "ClickOnce" Deployment.  
1 Q. Does the ImageKit.NET support "ClickOnce" Deployment? N/A
  A. Yes, the ImageKit.NET supports both "NoTouch" and "ClickOnce" Deployment.