Version 12 of windows icons

Updated 2003-08-12 18:51:55

--AF 08-08-03

this package provides functions for reading and writing windows icons to ICO and EXE files.

the code has grown to become a little large for posting here. it is all available for download at

http://www.fearme.com/misc/programs.cgi?type=tcltk&file=icons

[IconStats file type] returns info on the icons within the file. there is one list element per icon. each element consists of 3 numbers, the width, height, and color depth of the icon. type must be one of ICO, EXE

[getIconImage file type index] returns the name of an image containing the icon named by file and index. index starts at 0, see IconStats.

[getIconColors file type index] returns a list where each element is a row of the image. each row is a list where each element is a pixel. each pixel is in the familiar form #RRGGBB. an empty pixel denotes transparency. the image rows are in a bottom to top order.

[writeIcon file type index bpp colors] writes an icon to the named file. colors is either a list in the above format, with the exception that each pixel is of the form "R G B" where each number has the range 0 to 255, or it is the name of an image from which to extract the data. bpp is the color depth to write the icon with. supported depths are 4 8 24 and 32. if you select 4 or 8 and your image has too many colors an error will be generated. index may be specified as one higher than the number of icons currently in the file. indexes outside this range will generate an error. when writing an exe you may only replace an icon with one of the same size and color depth. you cannot add new icons to exes.

[translateColors colors] this function will change a list of colors in the #RRGGBB format to the "R G B" format required by [writeIcon]

[transparentColor image color] sets every pixel that is color in Tk image image to be transparent. color may be either the #RRGGBB or the "R G B" format.

[EXEtoICO exe ico] creates a new .ico file with the name ico containing every icon from the exe exe. this function is much faster than extracting and writing the icons using the other functions.

some keywords for searches: ico icl


category gui