--[AF] 08-08-03 This package provides functions for reading and writing [windows] [icon]s to ICO, EXE, DLL, and ICL files. --[AF] 26-07-04 This code has become a [tklib] module. See [ico] for documentation and other information. ---- [CF] - This is the missing link for turning a Starpack into a branded application with your Icon. Here's a short script that accepts a gif image as the command line argument, and creates a tclkit.ico file that can be used to create a Starpack with custom icons, as decribed at http://www.equi4.com/267 . This script runs on a Linux/Unix system with ImageMagick installed. The initial .gif image must be square. ---- source icons.tcl set orig [lindex $argv end] set icoFile tclkit.ico pack [label .l -textvariable state] image create photo temp48 -file $orig ::ico::writeIcon $icoFile ICO 0 8 temp48 set pos -1 foreach s {48 32 16} { set name [format "temp%s" $s] set geom [format %dx%d $s $s] set state "$geom @ 256"; update idle; exec convert -geometry $geom -colors 256 $orig $name.gif image create photo $name -file $name.gif ::ico::writeIcon $icoFile ICO [incr pos] 8 $name set state "$geom @ 16"; update idle; exec convert -geometry $geom -colors 16 $orig r$name.gif image create photo r$name -file r$name.gif ::ico::writeIcon $icoFile ICO [incr pos] 4 r$name file delete $name.gif r$name.gif } set state "DONE - Icon file is $icoFile" pack [button .b -text "EXIT" -command exit] ---- Anyone have an icon editor written in Tcl/Tk? [AF] Not that i know of, but now that i have provided the required functionality i think it would be cool if someone wrote one since there seems to be a lack of free icon editors. [TR] There is one, a bitmap editor by Ian Gay, listed on [Applications in Tcl and Tcl/Tk]. Find it here: http://www.sfu.ca/~gay/ It would be nice to have a version including this package here. [KPV] There's also one right here in this Wiki at [Bitmap Editor]. [RS]: ... and another at [imEdit]. ---- [MJ] - The only really reliable way to get the correct icon associated with a file (correct in the sense that it will be the one displayed by explorer) is to use the SHGetFileInfo Win32 API call [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shgetfileinfo.asp]. For a small C extenstion that wraps this function see [Retrieve file icon using the Win32 API]. [AF] The latest version of ico gets pretty close by using the registry. see ico::getFileIcon. ---- '''See also''' [Reading a Windows icon file] [Writing a Windows icon file] ---- [Category GUI] | [Category Package] | [Category File]