Documentation


Frequently asked questions

Img version 2 does not return base64 encoded image data anymore.

Img versions previous to version 2 returned image data as base64 encoded data for historical reasons.

Tk returns image data as binary string, which is faster and needs less memory. So Img version 2 now returns image data as binary string, too.

If you need the image data as base64 encoded string, use the binary encode base64 command.

Some tests fail on macOS using Tk 9.0.4 or newer.

Tk 9.0.4 respects the color profile settings, so the output of the -format window option returns slightly different values depending on the used color profile (System settings->Displays->Color profile).

The following test script returns the values listed below:

package require Tk
package require Img

puts "Using Tk [package version Tk] and Img [package version Img]"

canvas .c 
pack .c
.c create rectangle 0 0 100 100 -fill "#0000FF"

update idletasks

set phImg [image create photo -format window -data .c]
puts "Color: [$phImg get 10 10]"

Using Tk 8.6.18 or Tk 9.0.3:
Color: 0 0 255

Using Tk 9.0.4 and different color profiles:
Color: 0 0 245 (Display P3, Color-LCD)
Color: 0 0 250 (Adobe RGB)
Color: 0 0 255 (General RGB-Profile, Rec. ITU-R BT.709-5, sRGB IEC61966-2.1)