http://www.tcl.tk/man/tcl8.5/TkCmd/photo.htm A photo [image] is the means that Tk uses to display full color images. Tk comes with support for GIF, PPM, and PGM formats, as well as a format to hook in code for other formats. The [Img] extension provides additional full color image formats. [Photo image rotation] - [Image scaling] ---- [DKF]: Although [Tk] can't load images with rich alpha channels (i.e. non-trivial transparency effects like you get with some [PNG] images) it can display them from 8.4 onwards. [LV]: Is the distinction between ''load'' and ''display'' that you make here a difference between minimally displaying the content versus displaying the content with the transparency effects? [DKF]: No. ''Load'' is the process of getting the image data created in memory from a file, and ''display'' is the putting of the image on the screen (including all transparency effects, if they're present). [LV]: Okay (it might be good to add that distinction to the man page). So, how does Tk 8.4 and on display PNG files if it can't load them? Or do you mean that Tk 8.4 can now load PNG images - just not the advanced ones? [wdb]: Is there any way known to "synthesize" memory-internal images with true alpha channel? [DKF]: Not yet (at the Tcl level); didn't have time to work on it. Assistance welcome. ---- [LV] I see a recent update to the [Changes in Tcl/Tk 8.6] page says that Tk 8.6 is going to support LZW compressed files. Does this mean that the patents for LZW have finally expired? [DKF]: According to Wikipedia[http://en.wikipedia.org/wiki/LZW#Patents_and_accreditation], it expired in 2003. We're now 5–6 years later, we're ''supposed'' to be able to make use of the algorithm now, that's the whole point of the way patents work. [LV] Of course - I just wanted to be certain that things had expired. I had a memory of articles back in 2003 that indicated there was still some sort of controversy over the patents and whether they really expired at that time. GraemeP: IBM also had a patent on the algorithm that expired in August 2008, so its less than 3 years later (see GNU page about GIF images [http://www.gnu.org/philosophy/gif.html] and Cygwin mailing list [http://www.cygwin.com/ml/cygwin/2004-07/msg00138.html]) [LV] The article you mention here, from gnu.org, seems to indicate that the IBM claims expired in 2006, not 2008. If that is the case, then things should be fine. ---- [AMG]: Is it possible to generate a photo image with transparency in Tcl script? It's certainly possible to generate a photo via the [[$photo put]] command, but I don't know how to specify that a particular pixel be transparent. [jima] 2012-02-10 I have this poor proc to turn all pixels of a given color (given by the color of a particular hand picked pixel) into transparent: ====== proc SetTransparent { img xP yP } { set transparent [.photo get $xP $yP] set h [image height $img] set w [image width $img] for {set x 0} {$x < $w} {incr x} { for {set y 0} {$y < $h} {incr y} { if {[$img get $x $y] == $transparent} { $img transparency set $x $y 1 } } } } ====== It surely can be improved to suit your needs. [AMG]: Thanks. It's a shame that transparency has to be set one pixel at a time. Also it would be nice if script could set an arbitrary alpha, not just 100% transparent and 100% opaque. <> Tk syntax help | Arts and crafts of Tcl-Tk programming | Command | Graphics