poSoft Text Logo
Tcl extensions
SGI related
Currently selected Unsupported
Tcl and VC2005
mktclapp patch
photo patch
glob patch
Related links
poSoft Logo
Valid XHTML 1.0 Transitional

tkImgPhoto.c - Patch for better performance


This patch adds a new option to the image command (-dither 1|0), so you can specify, if you want dithering take place or not. Switching dithering off reduces image display time significantly, especially on 16 bit displays, without loosing much image quality.


  • This patch is based on patch/bug # 224066.
    See http://charm.cs.uiuc.edu/users/olawlor/tmp/tkImgPhoto.patch for the original patch.
    I applied some changes to make it work correctly on Windows. (Patch2)
  • It works only for Tk 8.3 or 8.4.
    The patch also applies a modification - already integrated into 8.4 - which eliminates calling the dither code twice (Patch1).
  • Now the bad thing: It adds platform-dependent code (with #ifdefs) into a file located in the generic directory. Could surely be eliminated, if a day had more than 24 hours.
Here are some timing results (in seconds): PIII, 333 MHz, 16-bit depth
Timed command: .label configure -image $myImg (image size is 1024x1024)

      SuSE Linux 6.3:
                                With Patch1
	Original         1.50   0.80
	Patch2 dither=1  1.30   0.68
	Patch2 dither=0  0.35   0.20

      Windows 98:
                                With Patch1
	Original         1.80   Not tested
	Patch2 dither=1  1.40   0.70
	Patch2 dither=0  0.40   0.22
So, if you don't bother too much about image quality (dither=0), you are able to display images 7-8 times faster. If dithering is on, it's still more than 2 times faster.
Top of page


File name Description
tkImgPhoto.zip Patched Tk source files for T 8.3.2
Top of page