Previous section To contents Next section

12.11 Image.BMP

DESCRIPTION
This submodule keeps the BMP (Windows Bitmap) encode/decode capabilities of the Image module.

BMP is common in the Windows environment.

Simple encoding:
encode

SEE ALSO
Image, Image.Image and Image.Colortable

METHOD
Image.BMP._decode,
Image.BMP.decode,
Image.BMP.decode_header

SYNTAX
object decode(string data)
mapping _decode(string data)
mapping decode_header(string data)
object decode(string data, mapping options)
mapping _decode(string data, mapping options)
mapping decode_header(string data, mapping options)

DESCRIPTION
Decode a BMP.

decode gives an image object, _decode gives a mapping in the format

"type":"image/bmp",
"image":image object,
"colortable":colortable object (if applicable)

"xsize":int, "ysize":int, "compression":int, "bpp":int, "windows":int,

RETURNS
the encoded image as a string

BUGS
Doesn't support all BMP modes. At all.

SEE ALSO
encode

METHOD
Image.BMP.encode

SYNTAX
string encode(object image)
string encode(object image, mapping options)
string encode(object image, object colortable)
string encode(object image, int bpp)

DESCRIPTION
Make a BMP. It default to a 24 bpp BMP file, but if a colortable is given, it will be 8bpp with a palette entry.

option is a mapping that may contain:

"colortable": Image.Colortable   - palette
"bpp":        1|4|8|24           - force this many bits per pixel
"rle":        0|1                - run-length encode (default is 0)

ARGUMENTS
argument(s)description
object image
Source image.
object colortable
Colortable object, shortcut for "colortable" in options.

RETURNS
the encoded image as a string

BUGS
Doesn't support old BMP mode, only "windows" mode.

SEE ALSO
decode

Previous section To contents Next section