ImageTcl is a powerful tool that allows you to:
Write your own scripts or application programs
For example, you may regularly need to convert image files to a particular size. Using ImageTcl, you can write your own script or program to perform this conversion.
Make use of image-processing operations not available to you through the other ImageVision application tools, such as ImageView
ImageTcl allows you to make use of any of the numerous image-processing operations available in the ImageVision Library (IL) package. Opening an image, rotating an image, and changing the color model of an image might all be considered examples of basic operations on the image.
An application tool such as ImageView makes many of these operations easily accessible (see Chapter 2, “ImageView”). However, you can use ImageTcl to access operations that are in the ImageVision package but are not available to you through application tools such as ImageView.
ImageTcl may be particularly helpful for users who have some programming background. You can use ImageTcl in two ways:
You can work interactively in the shell window by invoking ImageTcl and entering commands (see “Examples of Using ImageTcl Interactively”).
You can create files containing scripts or programs that are executed using ImageTcl (see “Examples of ImageTcl Scripts or Programs”).
The ImageTcl tool is built using Tcl, a publicly available scripting language. Whether you are typing ImageTcl commands interactively or writing programs to be executed by ImageTcl, you must use the Tcl language. To obtain more information on Tcl, you may want to refer to the following book: Ousterhout, John K., Tcl and the Tk Toolkit, Addison-Wesley Publishing Company, 1994.
If you have the IRIS Development Option, see the ImageVision Library/Image Format Library (IL/IFL) manual pages for information on each of the operations available in the ImageVision Library package. You can also view these manual pages if you have access to the World Wide Web, by visiting the following site:
http://www.sgi.com/Technology/ImageVision/man/ILman.html
Each of these manual pages describes an operation and indicates the operation's command name, to use in writing scripts or when working interactively. For successful operation of ImageTcl, either type the command name entirely in lowercase or type it exactly as it is shown in the manual page, noting the case of each letter.
For demonstration purposes, this section contains instructions on using ImageTcl to perform some simple operations. In this series of examples, you are working interactively in the shell window. (A word of caution: A string of letters used frequently in these commands—“img”—is easily mistaken to be “ing,” leading to errors.)
To invoke ImageTcl, enter imgtcl at the prompt in the shell window.
The imgtcl prompt appears in the shell window.
To select an image file for processing, enter
ilfileimgopen file filename |
where filename is the name of the file you wish to open. The word “file” displays, and then the imgtcl prompt appears again.
To display the image, at the prompt enter
file
The ImageTcl Viewer window opens, displaying the image.
The ImageTcl Viewer operates similarly to the ImageView window. For information that is useful in understanding the ImageTcl Viewer, refer to Chapter 2, “ImageView.”
Close the window by double-clicking the button located to the left of the window name, or quit the viewer by choosing Quit from the File menu.
The ImageTcl Viewer window closes, and the ImageTcl prompt appears again in the shell window.
To process the file by applying a compass filter to it, enter
ilcompassimg compass file
The word “compass” displays, and then the ImageTcl prompt appears again.
To display the filtered image in the ImageTcl Viewer window, enter
compass
The ImageTcl window opens, displaying the filtered image.
Close the window by double-clicking the button located to the left of the window name, or quit the viewer by choosing Quit from the File menu.
The ImageTcl Viewer window closes, and the ImageTcl prompt appears again.
To exit the ImageTcl interpreter and return to your usual shell window prompt, enter
exit
This section contains instructions enabling you to see examples of files containing scripts or programs—sequences of commands—that can be executed using ImageTcl.
At the standard prompt in your shell window, enter
cd /usr/share/src/imgtcl |
To see the three sample files listed in directory, enter
ls |
To display the contents of any of these files, enter
more filename |
where filename is the name of the file you wish displayed.
In order to have access to these script file examples, the imagetools.sw.gifts subsystem must have been installed on your system. If you used the default installation of ImageVision Tools, Version 3.1, this subsytem is installed on your system.