File: XpmWriteOptions.tcl

package info (click to toggle)
libtk-img 1%3A2.0.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 47,852 kB
  • sloc: ansic: 224,696; sh: 20,589; tcl: 8,921; makefile: 2,272; cpp: 1,933; ada: 1,681; pascal: 1,139; cs: 879; awk: 794; asm: 587; python: 542; xml: 95
file content (25 lines) | stat: -rwxr-xr-x 789 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package require Tk
package require img::xpm

puts "Using [expr $tcl_platform(pointerSize) *8]-bit Tcl [info patchlevel], Tk $::tk_patchLevel, img::xpm [package require img::xpm]"
catch { file mkdir testOut }

set imgFile [file join ".." "sourceimgs" "fractal.xpm"]

# Read a XPM file into a photo image.
set imgRGB [image create photo -file $imgFile]

# Write XPM file using verbose option.
set outFile [file join "testOut" "xpm.xpm"]
$imgRGB write $outFile -format [list XPM -verbose ON]
set img [image create photo -file $outFile -format [list XPM -verbose true]]
label .img -image $img -compound top -relief ridge -text "XPM -verbose 1"
grid .img -row 0 -column 0 -padx 5 -pady 5 -sticky ew

bind . <Escape> exit

if { [lindex $argv 0] eq "auto" } {
    update
    after 500
    exit
}