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

Related Posts

  • Circular Icons for Objectdock I use objectdock free on one of my XP systems and have just decided to install NWN2 […]
  • Shell Programming This page never seems to age, it just contains some idioms I like to use in my .login […]
  • EXIF and MacOS X I have listened to Stop 43, and the British Journal of Photography I have read what Tim […]
  • Scripting on Windows I need a couple of jobs done on my desktop machines (all Windows XP) and have been […]
  • RCS Revision Control System, one of the grand daddies of them all. I still use it because […]

2 thoughts on “Using “boomy” icons with tcl/tk

  1. 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 *