Pike v8.0 release 1738

Method Image.PNG._decode()


Method _decode

mapping _decode(string|array data)
mapping _decode(string|array data, mapping options)

Description

Decode a PNG image file.

Parameter options
"colortable" : string|array|Image.Colortable

A replacement color table to be used instead of the one in the PNG file, if any.

Returns
"image" : Image.Image

The decoded image.

"bpp" : int

Number of bitplanes in the image. One of 1, 2, 4, 8 and 16.

"type" : int

Image color type. Bit values are:

1

Palette used.

2

Color used.

4

Alpha channel used.

Valid values are 0, 2, 3, 4 and 6.

"xsize" : int

Image dimensions.

"ysize" : int
"background" : array(int)

The background color, if any. An array of size three with the RGB values.

"alpha" : Image.Image

The alpha channel, if any.

Throws

Throws an error if the image data is erroneous.

Note

Please read about the PNG file format. This function ignores any checksum errors in the file. A PNG of higher color resolution than the Image module supports (8 bit) will lose that information in the conversion.