8.4 Handling Images

A convenient way to create images is given by TkTools.images. It takes a list of URLs as input and returns a record of images, where the fields are atoms derived naturally from the URLs. The type and format of images is handled according to the extension of the URL.

For example,

U='http://www.mozart-oz.org/home-1.1.0/doc/wp/' 
I={TkTools.images [U#'wp.gif'  
                   U#'queen.xbm'  
                   U#'truck-left.ppm']}

binds I to a record with features wp, queen, and 'truck-left', where the fields are the corresponding images.

First the basename of the URL is computed by taking the last fragment of the URL (that is, 'wp.gif' for example). The extension (the part following the period, 'gif' for example), determines the type and format of the image. The part of the basename that precedes the period yields the feature.


Christian Schulte
Version 1.4.0 (20080702)