Using "boomy" icons with tcl/tk

I spent some time over the last few days trying to populate the TK images folder with a usable image library. The activestate version and the standard only permits the use of .gif images in the image manipulation commands. (Not true now, see the comments!) I might need to look at the tkImg package to use an alternative format.

Using ImageMagick to create .gif from .png

I wanted to use the Boomy icon set. This comes in .gif, .ico and .png. The .png is really good. The .gif has the wrong transparency colour set and so needs conversion. There are quite a lot so I wanted to use a batch operation.
I chose to use ImageMagick. I used cygwin shell to manage the batch logic. I chose to use the .png icons as my source.

convert accept.png accept.gif

is the code rune that works, where accept is the name of the icon. So I created a directory containing the source images. I symlinked the Program Files folder to a new folder in the cywin $HOME folder, I called it imbin. N.B. dos has a convert command so you need to manage the PATH well, but I decided to explicitly invoke the command by its full hierarchical name. Here’s my code

# I have symlinked the folder to $HOME/imbin
CONVERT=$HOME/imbin/convert.exe
[ -x $CONVERT ] && echo $CONVERT is executable
cd im
for i in `ls *.png`
do
    echo -n processing ${i%.png}
    ${CONVERT} $i ${i%.png}.gif
    echo … done
done

I blogged about this on 4th Dec 2009. This included the following words, which I then deleted from the blog.

Does TCL ‘image create’ work with .bmp files. It claims to support bit maps but I suspect that these are an old/ancient standard, I have tested the image create statement with .jpg, .png and .bmp files and none of these work, I have also tried to use the -format flag and this fails to find the filters.I have created a .gif file with transparency by converting the .png, (using GIMP) and now may want to do this as a batch operation, although the quality of the edges is a bit poor.

I have just done this to the home server since I have written a new TCL script which I need on all my computers. Imagemagick now writes its location into the windows $PATH variable, so all the mucking about to ensure that the ksh interpreter can run the imagemagick convert program is no longer required. 20 March 2010

Using "boomy" icons with tcl/tk

3 thoughts on “Using "boomy" icons with tcl/tk

  1. Dave says:

    It seems that the Boomy Icons PNG 256 come with transparency and the current activestate wish i.e. TCL/TK 8.6 takes .png as an argument for ‘image create’ i.e. copy the .png files into the $tk_library/images folder. 6th Nov 2014

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.