1image(n) Tk Built-In Commands image(n)
2
3
4
5______________________________________________________________________________
6
8 image - Create and manipulate images
9
11 image option ?arg arg ...?
12_________________________________________________________________
13
14
16 The image command is used to create, delete, and query images. It can
17 take several different forms, depending on the option argument. The
18 legal forms are:
19
20 image create type ?name? ?option value ...?
21 Creates a new image and a command with the same name and returns
22 its name. type specifies the type of the image, which must be
23 one of the types currently defined (e.g., bitmap). name speci‐
24 fies the name for the image; if it is omitted then Tk picks a
25 name of the form imagex, where x is an integer. There may be
26 any number of option-value pairs, which provide configuration
27 options for the new image. The legal set of options is defined
28 separately for each image type; see below for details on the
29 options for built-in image types. If an image already exists by
30 the given name then it is replaced with the new image and any
31 instances of that image will redisplay with the new contents.
32 It is important to note that the image command will silently
33 overwrite any procedure that may currently be defined by the
34 given name, so choose the name wisely. It is recommended to use
35 a separate namespace for image names (e.g., ::img::logo,
36 ::img::large).
37
38 image delete ?name name ...?
39 Deletes each of the named images and returns an empty string.
40 If there are instances of the images displayed in widgets, the
41 images will not actually be deleted until all of the instances
42 are released. However, the association between the instances
43 and the image manager will be dropped. Existing instances will
44 retain their sizes but redisplay as empty areas. If a deleted
45 image is recreated with another call to image create, the exist‐
46 ing instances will use the new image.
47
48 image height name
49 Returns a decimal string giving the height of image name in pix‐
50 els.
51
52 image inuse name
53 Returns a boolean value indicating whether or not the image
54 given by name is in use by any widgets.
55
56 image names
57 Returns a list containing the names of all existing images.
58
59 image type name
60 Returns the type of image name (the value of the type argument
61 to image create when the image was created).
62
63 image types
64 Returns a list whose elements are all of the valid image types
65 (i.e., all of the values that may be supplied for the type argu‐
66 ment to image create).
67
68 image width name
69 Returns a decimal string giving the width of image name in pix‐
70 els.
71
72 Additional operations (e.g. writing the image to a file) may be avail‐
73 able as subcommands of the image instance command. See the manual page
74 for the particular image type for details.
75
77 The following image types are defined by Tk so they will be available
78 in any Tk application. Individual applications or extensions may
79 define additional types.
80
81 bitmap Each pixel in the image displays a foreground color, a back‐
82 ground color, or nothing. See the bitmap manual entry for more
83 information.
84
85 photo Displays a variety of full-color images, using dithering to
86 approximate colors on displays with limited color capabilities.
87 See the photo manual entry for more information.
88
89
91 bitmap(n), options(n), photo(n)
92
93
95 height, image, types of images, width
96
97
98
99Tk 4.0 image(n)