1ico(n)                       Windows ICO handling                       ico(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ico - Reading and writing windows icons
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require ico  ?0.3?
14
15       ::ico::getIconList file ?option value...?
16
17       ::ico::getIcon file index ?option value...?
18
19       ::ico::writeIcon file index depth data ?option value...?
20
21       ::ico::copyIcon file index file2 index2 ?option value...?
22
23       ::ico::EXEtoICO file file2
24
25       ::ico::clearCache ?file?
26
27       ::ico::transparentColor image color
28
29       ::ico::Show file ?option value...?
30
31_________________________________________________________________
32

DESCRIPTION

34       This  package  provides functions for reading and writing Windows icons
35       from ICO, EXE, DLL, ICL, and BMP files.
36

API

38       ::ico::getIconList file ?option value...?
39              Returns a list of icons found in file where each element has the
40              format {width height depth}. Recognizes the following options.
41
42              -type fileFormat
43
44
45       ::ico::getIcon file index ?option value...?
46              Extracts  the  icon  at index from file.  The default -format is
47              image which will return the name of a Tk  image  containing  the
48              icon. Optionally -name may be used to specify the name of the Tk
49              image that is created. If -format is colors then a list of color
50              names  in the #RRGGBB format is returned. Each list element is a
51              horizontal row. Each horizontal row contains a  list  of  colors
52              for  all  the pixels in that row from left to right.  Recognizes
53              the following options.
54
55              -type fileFormat
56
57              -format value
58
59              -name value
60
61
62       ::ico::writeIcon file index depth data ?option value...?
63
64              file fileName (in)
65
66              index integer (in)
67                     This is the 0-based index of  the  icon  to  write.  When
68                     writing  to  an  EXE, DLL, or ICL file you may only over‐
69                     write existing icons with an icon of the same  dimensions
70                     and  color  depth.   When writing to an ICO, index may be
71                     one greater than the last icon. This will  append  a  new
72                     icon  to  the  file.   When writing to an ICO, index will
73                     accept end. This will also  cause  the  new  icon  to  be
74                     appended  to  the file.  When writing the other types end
75                     will refer to the last existing icon.
76
77              depth integer (in)
78                     This argument must have a value of 1, 4, 8, 24, or 32. If
79                     data has more colors than the color depth allows an error
80                     will be generated.
81
82              data options (in)
83                     This argument is either a list of colors  in  the  format
84                     returned  by ::ico::getIcon -format colors or the name of
85                     a Tk image.
86
87       Recognizes the following options.
88
89              -type fileFormat
90
91
92       ::ico::copyIcon file index file2 index2 ?option value...?
93              Copies the icon at index in file to index2 in file2.
94
95              -fromtype fileFormat
96
97              -totype fileFormat
98
99
100       ::ico::EXEtoICO file file2
101              Extracts all icons from the executable  file  to  the  ICO  file
102              file2.
103
104              -type fileFormat
105
106
107       ::ico::clearCache ?file?
108              The  ::ico::getIconList  command caches icon offsets inside EXE,
109              DLL, and ICL files in order to speed up extraction.   This  com‐
110              mand clears that cache for the specific ?file? or all files.
111
112       ::ico::transparentColor image color
113              If  image  is a single word it is assumed to be the name of a Tk
114              image.  All pixels matching color  in  the  image  will  be  set
115              transparent.   Alternatively, image may be a color list in which
116              case a modified list is returned.
117
118       ::ico::Show file ?option value...?
119              Application level command which displays a  window  showing  all
120              the icons in file with information about them.
121
122              -type fileFormat
123
124              -parent pathName
125

EXAMPLE

127           button .explore -image [::ico::getIcon explorer.exe 0 -name explore]
128           set i [lsearch [::ico::getIconList tclkit.exe] {32 32 8}]]
129           set colorlist [::ico::getIcon tclkit.exe $i -format colors -type EXE]
130
131

LIMITATIONS

133       Icons may not be added or removed from file types other than ICO. Icons
134       in these files may only be replaced with icons of the  same  dimensions
135       and color depth.
136
137       Icons of 8bpp or lower must include black in the pallete, this means if
138       your icon does not have black in it, you will need  to  leave  a  color
139       free so that it may be included by writeIcon.
140
141       There  is currently no way to read alpha channel information from 32bpp
142       icons.
143
144       Tk images do not have an alpha channel so the only way to write a  true
145       32bpp icon is from a color list. writing a 32bpp icon from a Tkimage is
146       identical to writing a 24bpp icon.
147
148           button .explore -image [::ico::getIcon explorer.exe 0 -name explore]
149           set i [lsearch [::ico::getIconList tclkit.exe] {32 32 8}]]
150           set colorlist [::ico::getIcon tclkit.exe $i -format colors -type EXE]
151
152

KEYWORDS

154       dll, entry, exe, ico, icon
155
156
157
158ico                                   0.3                               ico(n)
Impressum