Chapter 5. ImageTcl

ImageTcl is a powerful tool that allows you to:

ImageTcl may be particularly helpful for users who have some programming background. You can use ImageTcl in two ways:

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.

Obtaining Information and Command Names for Operations

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.

Examples of Using ImageTcl Interactively

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

  1. To invoke ImageTcl, enter imgtcl at the prompt in the shell window.

    The imgtcl prompt appears in the shell window.

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

  3. 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.”

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

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

  6. To display the filtered image in the ImageTcl Viewer window, enter

    compass

    The ImageTcl window opens, displaying the filtered image.

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

  8. To exit the ImageTcl interpreter and return to your usual shell window prompt, enter

    exit

Examples of ImageTcl Scripts or Programs

This section contains instructions enabling you to see examples of files containing scripts or programs—sequences of commands—that can be executed using ImageTcl.

  1. At the standard prompt in your shell window, enter

    cd /usr/share/src/imgtcl 
    

  2. To see the three sample files listed in directory, enter

    ls 
    

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

For Additional Information

For additional information on ImageTcl, see the imgtcl(1) reference page.