Previous section To contents Next section

12.12 Image.GD

DESCRIPTION
Handle encoding and decoding of GD images.

GD is the internal format of libgd by Thomas Boutell, http://www.boutell.com/gd/ It is a rather simple, uncompressed, palette format.

METHOD
Image.GD._decode,
Image.GD.decode,
Image.GD.decode_alpha,
Image.GD.decode_header

SYNTAX
object decode(string data)
object decode_alpha(string data)
mapping decode_header(string data)
mapping _decode(string data)

DESCRIPTION
decodes a GD image

The decode_header and _decode has these elements:

"image":object            - image object    \
"alpha":object            - decoded alpha   |- not decode_header
"colortable":object       - decoded palette /

"type":"image/x-gd" - image type "xsize":int - horisontal size in pixels "ysize":int - vertical size in pixels "alpha_index":int - index to transparancy in palette -1 means no transparency "colors":int - numbers of colors

METHOD
Image.GD.encode

SYNTAX
string encode(object image)
string encode(object image, mapping options)

DESCRIPTION
encode a GD image

options is a mapping with optional values:

"colortable":object       - palette to use (max 256 colors)
"alpha":object            - alpha channel (truncated to 1 bit)
"alpha_index":int         - index to transparancy in palette


Previous section To contents Next section