Img Manual

Introduction Installation Format handlers External libraries

Format handlers

The pixmap image type can be used as follows:
image create pixmap -file
or
image create pixmap -data ;#(in XPM format)
The photo image type works the same:
image create photo -file
or
image create photo -data ;#(base-64 encoding required with Tk8.2 and lower)

Valid format specifiers for reading photo's:

  "bmp"
  "gif -index <n>"
  "jpeg -fast -grayscale"
  "png"
  "tiff"
  "xbm"
  "xpm"
  "postscript -index <n> -zoom <x> <y>" (-index not yet implemented)
  "window" (works only with "-data", not "-file")

Valid format specifiers for writing photo's:

  "bmp"
  "gif -interlaced <bool>" (-interlaced not yet implemented)
  "jpeg -quality <n> -smooth <n> -grayscale -optimize -progressive"
  "png Author <name> Title <title> Description ....."
Each pair of arguments will add a named text chunk to the file.
  "tiff -compression <compression> -byteorder <byteorder>"
  "xbm"
  "xpm"

The format options have the following meaning:

  -background C: use color C as background color for transparent parts of the image.
  -byteorder: Byteorder for TIFF file. Should be one of bigendian, littleendian, network, smallendian or {}. Default: {}
  -compression: Compression for TIFF file. Should be one of none, jpeg, packbits or deflate. Default: none.
  -fast: Fast, low-quality processing.
  -grayscale: Force incoming image to grayscale/ Create monochrome file.
  -index N: Select one of the sub-images (GIF and postscript only, not yet implemented for postscript). Default value: 0
  -interlaced N: N=1: interlaced. N=0: non-interlaced (not yet implemented).
  -optimize: Optimize Huffman table.
  -progressive: Create progressive file (JPEG only).
  -quality N: Compression quality (0..100; 5-95 is useful range). Default value: 75
  -smooth N: Perform smoothing (10-30 is enough for most GIF's). Default value: 0
  -zoom X Y: Multiply image size by given scale factors. If Y is missing, the default is the same as X. X and Y are allowed to be in floating point format, but they are rounded to the nearest practically possible value. For postscript this means the zoom factors should be multiples of 1/72.