ImageControls 3.1 Application NoteImageControls Toolkit 3.1 is the latest release of the Kofax ImageControls Toolkit product. |
To access the following Web pages for this release, please click on the desired page's link. Application Notes - Error Codes - Frequently Asked Questions - Revision Levels - Supported Configurations |
Creating an Image Viewer and InverterImageControls developers have expressed great interest in being able to manipulate images after they have been scanned and saved. Though v2.x and v3.x of the ImageControls Toolkit includes the ability to perform some image enhancement, it is designed to primarily provide the ability to capture image data. The ability to manipulate image data is considered secondary. Previously, ImageControls allowed a developer to display images that were shown in reverse color. This capability is not presently functioning in the ImageControls KView control. This will be corrected in the future, but the following project will demonstrate how, through the use of Microsoft's own Windows 95, Windows 98 and Windows NT 4.0 built in imaging capabilities, a developer would be able to create a temporary "workaround" solution. One typical use of displaying a image in inverted format would be for viewing images stored on microfilm or microfiche, where the background is black and image is not easily read. This project modifies the original demonstration utility, VBDEM32x.EXE, source code as provided with the ImageControls Toolkit. It consists of the following:
Figure 1 displays the placement of these objects on the form. This form is accessed from the main form, frmMain, of VBDemo. A menu selection was added to the View pull down menu of the main form. When this is selected, frmInvert is displayed along with the inverted image. The active image, g_ActiveKview object, in the main form contains the original image. The item mnuViewInvert is added after the item mnuViewDisplayProperties in the Menu Editor for the menu of the main form. The following code was created so that the new form would be displayed when this menu item was selected:
The form is displayed in application modal format. This form must be closed to continue. The procedure Private Sub mnuView_Click()was modified with the following:
This change was added to the end of the procedure so that the menu item would only become available when a active image was being viewed and ready to be inverted. After this point, all additional code is contained in its own module with its own form, its own KScan control and its own ImgAdmin and ImgEdit controls. The only module global variable is g_FileName, which is declared in the General Declarations:
The size and placement of the form is first step when the form is loaded. The second step includes reserving the import source. This project uses file importation, and will select the first file import source setup in the Kofax Source Manager (KSM). This will normally be the default "Software File Import" source. A software file import source must be defined in the KSM. The import settings are set to overwrite and a single image, then the import process is started. The import process, using the KScan control, will import the active image in the main form and set the image photometric interpretation to inverted. Once this import process is completed, the source is unreserved. Finally, the ImgEdit control is used to display this new inverted image.
During the import process, the active image contained in the main form is set for import, and the caption for the form is set to display the path and filename of this image. A software engine performing a import will copy the data from the original image source file to the selected source file. As a result, if the user selects to invert a image that cannot be inverted, such as a JPEG format image or a greyscale or color TIFF image, then the image will be copied over without inverting the image data.
The image is imported to a temporary file "invtemp.tif". The property PEColor is set to invert the bit color (photometric interpretation) of the image data that is to be saved. This property is only valid during the KScan_PageEnd event. The global variable name is set to the temporary file. This module global variable is used instead of a constant value as it also acts as a flag for the ImgEdit1.Display statement during the frmInvert_Resize event.
The KScan controls Error event contains simple code to handle an error if one is encountered in importing the image.
The form may be resized. If the form is resized, so is the ImgEdit control and the image being displayed. The image will either be set to fit to width or fit to height.
The form displaying the inverted image includes a menu. This menu consists of:
The menu selections are used to print the inverted image, exit the form and adjust the scale of the view. ImgAdmin is used to display the Print dialog box.
When exiting the invert form is unloaded and the VBDemo main form displayed.
The various view selections are used to dynamically fit the image to the ImgEdit control height or width, or to view the image at 100%, 50% or 25% scale.
You can also download the .frm used to build this project and add it to the VBDEMO code that ships with ImageControls 3.x. |
