I spent some time over the last few days trying to populate the TK images folder with a usable image library. It seems we can now use .png//.jpg. Jan 2023.

In Dec 2022, i found out that tcltk/wish will now process .png images, this page, describes how although the functionality just seems to be there.

The TCL image command manual page, and  very old note on extending TCL to manage other formats.

Otherwise,

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

N.B. dos has/had a convert command so on windows you need to manage the PATH so that imagick’s bin folder is early in the path; I decided to explicitly invoke the command by its full hierarchical name. Here’s my code to do a complete directory, now on github.bash

5 Replies

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

  2. 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

  3. 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.