The image command is used to create, delete, and query images.
It can take several different forms, depending on the
option argument. The legal forms are:
- image create bitmap ?name? ?option value ...?
- Creates a new image and returns its name.
name specifies the name for the image; if it is omitted then
Tk picks a name of the form imagex, where x is
an integer.
The following options are supported:
- -file name
- name gives the name of a file whose contents define the
source bitmap.
The file must be in
image(6)
format.
- -maskfile name
- name gives the name of a file whose contents define the
mask. The file must be in
image(6)
format.
If an image already exists by the given name then it is replaced
with the new image.
Transparency effects can be achieved by either the source image including an alpha channel
or by specifying a mask image.
If a mask is specified then the resultant image is generated by rendering the source
through the mask onto a transparent destination image.
The following commands are posible for images:
- image delete ?name name ...?
- Deletes each of the named images and returns an empty string.
Each image name is invalidated.
If there are instances of the images displayed in widgets,
the images won't actually be deleted until all of the instances
are released.
- image height name
- Returns a decimal string giving the height of image name
in pixels.
- image names
- Returns a list containing the names of all existing images.
- image type name
- Returns ``bitmap'' if
name
is an existing image, or an error otherwise.
- image width name
- Returns a decimal string giving the width of image name
in pixels.